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

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

Defined Under Namespace

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

Class Method Summary collapse

Class Method Details

.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



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cucumber/core/test/result.rb', line 12

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

    [:passed, :failed, :undefined, :unknown, :skipped, :pending].each do |possible_result_type|
      define_method("#{possible_result_type}?") do
        possible_result_type == to_sym
      end
    end
  end
end