Class: CallSheet::ResultMatcher::FailureMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/call_sheet/result_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ FailureMatcher

Returns a new instance of FailureMatcher.



23
24
25
26
# File 'lib/call_sheet/result_matcher.rb', line 23

def initialize(result)
  @result = result
  @value = result.value
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



20
21
22
# File 'lib/call_sheet/result_matcher.rb', line 20

def result
  @result
end

#valueObject (readonly)

Returns the value of attribute value.



21
22
23
# File 'lib/call_sheet/result_matcher.rb', line 21

def value
  @value
end

Instance Method Details

#on(step_name, &block) ⇒ Object



28
29
30
31
32
33
# File 'lib/call_sheet/result_matcher.rb', line 28

def on(step_name, &block)
  if value.__step_name == step_name
    @matched = true
    block.call value
  end
end

#otherwise(&block) ⇒ Object



35
36
37
# File 'lib/call_sheet/result_matcher.rb', line 35

def otherwise(&block)
  block.call value unless @matched
end