Class: CallSheet::ResultMatcher::FailureMatcher
- Inherits:
-
Object
- Object
- CallSheet::ResultMatcher::FailureMatcher
- Defined in:
- lib/call_sheet/result_matcher.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(result) ⇒ FailureMatcher
constructor
A new instance of FailureMatcher.
- #on(step_name, &block) ⇒ Object
- #otherwise(&block) ⇒ Object
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
#result ⇒ Object (readonly)
Returns the value of attribute result.
20 21 22 |
# File 'lib/call_sheet/result_matcher.rb', line 20 def result @result end |
#value ⇒ Object (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 |