Sha256: c4c5dee52aa51541920ac6c5a3c4f08874cdf0fcfcd2159f5ab89e45527bc373

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 Bytes

Contents

require 'hashie/dash'

module Polytrix
  class Result < Hashie::Dash
    extend Forwardable
    include Hashie::Extensions::Coercion

    property :execution_result # , required: true
    def_delegators :execution_result, :stdout, :stderr, :exitstatus
    property :source_file # , required: true
    property :data
    property :validations, default: Validations.new
    coerce_key :validations, Validations

    def status
      # A feature can be validated by different suites, or manually vs an automated suite.
      # That's why there's a precedence rather than boolean algebra here...
      return 'failed' if validations.any? { |v| v.result == 'failed' }
      return 'passed' if validations.any? { |v| v.result == 'passed' }
      return 'pending' if validations.any? { |v| v.result == 'pending' }
      'skipped'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
polytrix-0.1.2 lib/polytrix/result.rb
polytrix-0.1.1 lib/polytrix/result.rb
polytrix-0.1.0 lib/polytrix/result.rb