diff --git a/lib/inferno/result_summarizer.rb b/lib/inferno/result_summarizer.rb index eb91f2745..30e831fb5 100644 --- a/lib/inferno/result_summarizer.rb +++ b/lib/inferno/result_summarizer.rb @@ -12,6 +12,8 @@ def initialize(results) end def summarize + return 'wait' if results.any? { |result| result.result == 'wait' } + return 'pass' if optional_results_passing_criteria_met? prioritized_result_strings.find { |result_string| unique_result_strings.include? result_string } diff --git a/spec/inferno/result_summarizer_spec.rb b/spec/inferno/result_summarizer_spec.rb index 74472ef1d..40e0f3457 100644 --- a/spec/inferno/result_summarizer_spec.rb +++ b/spec/inferno/result_summarizer_spec.rb @@ -3,6 +3,7 @@ RSpec.describe Inferno::ResultSummarizer do let(:passing_result) { repo_create(:result, result: 'pass') } let(:failing_result) { repo_create(:result, result: 'fail') } + let(:waiting_result) { repo_create(:result, result: 'wait') } context 'when all results are required' do it 'returns the highest priority result' do @@ -29,5 +30,12 @@ expect(result).to eq('pass') end + + it 'returns "wait" if an optional result is waiting' do + allow(waiting_result).to receive(:optional?).and_return(true) + result = described_class.new([passing_result, waiting_result]).summarize + + expect(result).to eq('wait') + end end end