Skip to content

Commit

Permalink
updated test_runner_spec
Browse files Browse the repository at this point in the history
Signed-off-by: Vanessa Fotso <[email protected]>
  • Loading branch information
vanessuniq committed Aug 1, 2024
1 parent f3d6cd0 commit f7d7ce9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions spec/inferno/test_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,28 @@ def error_results_message(error_results)
end
end

describe 'when running runnable with mixed required and optional children' do
let(:suite) { InfrastructureTest::Suite }
let(:required_groups) { suite.children.select(&:required?) }
let(:test_run) do
repo_create(:test_run, runnable: { test_suite_id: suite.id }, test_session_id: test_session.id)
end

it 'updates the runnable result when all required children have run' do
required_groups.each { |group| runner.run(group) }

expect(runner.run_results[suite.id]).to be_present
end

it 'does not update the runnable result when all required children have not run' do
runner.run(required_groups.first)
expect(runner.run_results[suite.id]).to be_nil
end
end

describe 'when custom result block provided to the runnable' do
let(:suite) { CustomResult::Suite }
let(:groups) { suite.children.select(&:required?) }
let(:required_groups) { suite.children.select(&:required?) }
let(:test_run) do
repo_create(:test_run, runnable: { test_suite_id: suite.id }, test_session_id: test_session.id)
end
Expand All @@ -220,7 +239,7 @@ def error_results_message(error_results)
end

it 'does not update the runnable result when all its children have not run' do
groups.each { |group| runner.run(group) }
required_groups.each { |group| runner.run(group) }
expect(runner.run_results[suite.id]).to be_nil
end
end
Expand Down

0 comments on commit f7d7ce9

Please sign in to comment.