Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ config/settings.local.yml

app/javascript/i18n/.env
vendor/bundle/
ruby-3.4.4/
8 changes: 6 additions & 2 deletions test/commands/solution/complete_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ class Solution::CompleteTest < ActiveSupport::TestCase
solution = create(:practice_solution, user:, exercise:)
create(:iteration, solution:)

Solution::Complete.(solution, user_track)
perform_enqueued_jobs do
Solution::Complete.(solution, user_track)
end

activity = User::Activities::CompletedExerciseActivity.last
assert_equal user, activity.user
Expand All @@ -73,7 +75,9 @@ class Solution::CompleteTest < ActiveSupport::TestCase
# Sanity check
assert solution.completed?

Solution::Complete.(solution, user_track)
perform_enqueued_jobs do
Solution::Complete.(solution, user_track)
end

solution.reload
assert solution.completed?
Expand Down
4 changes: 2 additions & 2 deletions test/commands/solution/publish_iteration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Solution::PublishIterationTest < ActiveSupport::TestCase
solution = create(:concept_solution)
create(:iteration, submission: create(:submission, solution:))

Solution::UpdatePublishedExerciseRepresentation.expects(:call).with(solution)
Solution::UpdatePublishedExerciseRepresentation.expects(:defer).with(solution)

Solution::Publish.(solution, user_track, nil)
end
Expand All @@ -83,7 +83,7 @@ class Solution::PublishIterationTest < ActiveSupport::TestCase
solution = create(:concept_solution)
create(:iteration, submission: create(:submission, solution:))

Solution::UpdateTags.expects(:call).with(solution)
Solution::UpdateTags.expects(:defer).with(solution)

Solution::Publish.(solution, user_track, nil)
end
Expand Down
6 changes: 4 additions & 2 deletions test/commands/solution/publish_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ class Solution::PublishTest < ActiveSupport::TestCase
solution = create(:practice_solution, user:, exercise:)
iteration = create(:iteration, solution:)

Solution::Publish.(solution, solution.user_track, iteration.idx)
perform_enqueued_jobs do
Solution::Publish.(solution, solution.user_track, iteration.idx)
end

activity = User::Activities::PublishedExerciseActivity.last
assert_equal user, activity.user
Expand Down Expand Up @@ -594,7 +596,7 @@ class Solution::PublishTest < ActiveSupport::TestCase
solution = create(:concept_solution, user:, exercise:)
create(:iteration, solution:)

Solution::UpdatePublishedExerciseRepresentation.expects(:call).with(solution)
Solution::UpdatePublishedExerciseRepresentation.expects(:defer).with(solution)
Solution::Publish.(solution, user_track, nil)
end
end
20 changes: 16 additions & 4 deletions test/integration/test_runner_flow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class TestRunnerFlowTest < ActionDispatch::IntegrationTest
test "runs the tests for an iteration submission" do
# Stub things we don't care about here
Iteration::GenerateSnippet.any_instance.stubs(:call)
Solution::UpdateNumLoc.any_instance.stubs(:call)
Solution::UpdateNumLoc.stubs(:defer)
Solution::UpdateTags.stubs(:defer)
Solution::UpdatePublishedExerciseRepresentation.stubs(:defer)
Solution::UpdateSnippet.stubs(:defer)
Iteration::CountLinesOfCode.any_instance.stubs(:call)

solution = create(:concept_solution)
Expand Down Expand Up @@ -75,7 +78,10 @@ class TestRunnerFlowTest < ActionDispatch::IntegrationTest
test "handles a new git sha being pushed: failing" do
# Stub things we don't care about here
Iteration::GenerateSnippet.any_instance.stubs(:call)
Solution::UpdateNumLoc.any_instance.stubs(:call)
Solution::UpdateNumLoc.stubs(:defer)
Solution::UpdateTags.stubs(:defer)
Solution::UpdatePublishedExerciseRepresentation.stubs(:defer)
Solution::UpdateSnippet.stubs(:defer)
Iteration::CountLinesOfCode.any_instance.stubs(:call)

exercise = create :practice_exercise, git_sha: '0b04b8976650d993ecf4603cf7413f3c6b898eff'
Expand Down Expand Up @@ -178,7 +184,10 @@ class TestRunnerFlowTest < ActionDispatch::IntegrationTest
test "handles a new git sha being pushed: passing auto updates" do
# Stub things we don't care about here
Iteration::GenerateSnippet.any_instance.stubs(:call)
Solution::UpdateNumLoc.any_instance.stubs(:call)
Solution::UpdateNumLoc.stubs(:defer)
Solution::UpdateTags.stubs(:defer)
Solution::UpdatePublishedExerciseRepresentation.stubs(:defer)
Solution::UpdateSnippet.stubs(:defer)
Iteration::CountLinesOfCode.any_instance.stubs(:call)

exercise = create :practice_exercise, git_sha: '0b04b8976650d993ecf4603cf7413f3c6b898eff'
Expand Down Expand Up @@ -271,7 +280,10 @@ class TestRunnerFlowTest < ActionDispatch::IntegrationTest
test "honours [no important files changed] and auto-updates" do
# Stub things we don't care about here
Iteration::GenerateSnippet.any_instance.stubs(:call)
Solution::UpdateNumLoc.any_instance.stubs(:call)
Solution::UpdateNumLoc.stubs(:defer)
Solution::UpdateTags.stubs(:defer)
Solution::UpdatePublishedExerciseRepresentation.stubs(:defer)
Solution::UpdateSnippet.stubs(:defer)
Iteration::CountLinesOfCode.any_instance.stubs(:call)

# This exercise contains the right set of things to
Expand Down
Loading