Skip to content

Commit

Permalink
Run representer and analyzer when exercise does not have test runner (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored Jun 5, 2024
1 parent cf13a0c commit 73211e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 1 addition & 3 deletions app/commands/iteration/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def call
end

def init_services
return unless solution.exercise.has_test_runner?

Submission::TestRun::Init.(submission) if submission.tests_not_queued?
Submission::TestRun::Init.(submission) if submission.tests_not_queued? && solution.exercise.has_test_runner?
Submission::Representation::Init.(submission) if submission.representation_not_queued?
Submission::Analysis::Init.(submission) if solution.track.has_analyzer?
end
Expand Down
20 changes: 20 additions & 0 deletions test/commands/iteration/create_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,26 @@ class Iteration::CreateTest < ActiveSupport::TestCase
Iteration::Create.(solution, submission)
end

test "creates representation if there's a representer but no test runner" do
track = create :track, has_representer: true
exercise = create(:concept_exercise, track:, has_test_runner: false)
solution = create(:concept_solution, exercise:)
submission = create(:submission, solution:)

Submission::Representation::Init.expects(:call).once
Iteration::Create.(solution, submission)
end

test "runs analysis if there's an analyzer but no test runner" do
track = create :track, has_analyzer: true
exercise = create(:concept_exercise, track:, has_test_runner: false)
solution = create(:concept_solution, exercise:)
submission = create(:submission, solution:)

Submission::Analysis::Init.expects(:call).once
Iteration::Create.(solution, submission)
end

test "do not analyze if there's no analyzer" do
track = create :track, has_analyzer: false
exercise = create(:concept_exercise, track:)
Expand Down

0 comments on commit 73211e1

Please sign in to comment.