Sha256: 80c5c7d3a5fff83f61588c0614aaaed2b1304cf2d64c0365d0e665ccad2a3cd4

Contents?: true

Size: 933 Bytes

Versions: 59

Compression:

Stored size: 933 Bytes

Contents

module Inferno
  # @private
  # This class takes an array of results and determines the overall result. This
  # is used to determine the result of a TestGroup/TestSuite based on the
  # results of it's children.
  class ResultSummarizer
    attr_reader :results

    def initialize(results)
      @results = results
    end

    def summarize
      prioritized_result_strings.find { |result_string| unique_result_strings.include? result_string }
    end

    private

    def prioritized_result_strings
      Entities::Result::RESULT_OPTIONS
    end

    def required_results
      @required_results ||= results.select(&:required?)
    end

    def all_optional_results?
      required_results.blank?
    end

    def results_for_summary
      all_optional_results? ? results : required_results
    end

    def unique_result_strings
      @unique_result_strings ||=
        results_for_summary.map(&:result).uniq
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
inferno_core-0.4.27 lib/inferno/result_summarizer.rb
inferno_core-0.4.26 lib/inferno/result_summarizer.rb
inferno_core-0.4.25 lib/inferno/result_summarizer.rb
inferno_core-0.4.24 lib/inferno/result_summarizer.rb
inferno_core-0.4.23 lib/inferno/result_summarizer.rb
inferno_core-0.4.22 lib/inferno/result_summarizer.rb
inferno_core-0.4.21 lib/inferno/result_summarizer.rb
inferno_core-0.4.20 lib/inferno/result_summarizer.rb
inferno_core-0.4.19 lib/inferno/result_summarizer.rb
inferno_core-0.4.18 lib/inferno/result_summarizer.rb
inferno_core-0.4.17 lib/inferno/result_summarizer.rb
inferno_core-0.4.16 lib/inferno/result_summarizer.rb
inferno_core-0.4.15 lib/inferno/result_summarizer.rb
inferno_core-0.4.14 lib/inferno/result_summarizer.rb
inferno_core-0.4.13 lib/inferno/result_summarizer.rb
inferno_core-0.4.12 lib/inferno/result_summarizer.rb
inferno_core-0.4.11 lib/inferno/result_summarizer.rb
inferno_core-0.4.10 lib/inferno/result_summarizer.rb
inferno_core-0.4.9 lib/inferno/result_summarizer.rb
inferno_core-0.4.8 lib/inferno/result_summarizer.rb