Module: Cucumber::Core::Test::Result

Defined in:
lib/cucumber/core/test/result.rb

Defined Under Namespace

Classes: Duration, Failed, Flaky, Passed, Pending, Raisable, Skipped, StrictConfiguration, Summary, Undefined, Unknown, UnknownDuration

Constant Summary collapse

TYPES =
%i[failed flaky skipped undefined pending passed unknown].freeze
STRICT_AFFECTED_TYPES =
%i[flaky undefined pending].freeze

Class Method Summary collapse

Class Method Details

.ok?(type, strict: StrictConfiguration.new) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/cucumber/core/test/result.rb', line 13

def self.ok?(type, strict: StrictConfiguration.new)
  class_name = type.to_s.slice(0, 1).capitalize + type.to_s.slice(1..-1)
  const_get(class_name).ok?(strict: strict.strict?(type))
end

.query_methods(result_type) ⇒ Object

Defines to_sym on a result class for the given result type

Defines predicate methods on a result class with only the given one returning true



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cucumber/core/test/result.rb', line 22

def self.query_methods(result_type)
  Module.new do
    define_method :to_sym do
      result_type
    end

    TYPES.each do |possible_result_type|
      define_method("#{possible_result_type}?") do
        possible_result_type == to_sym
      end
    end
  end
end