Class: Riot::RR::Assertion
- Inherits:
-
Assertion
- Object
- Riot::RunnableBlock
- Assertion
- Riot::RR::Assertion
- Defined in:
- lib/riot/rr.rb
Overview
Binds the Assertion to RR so that successes and failures found by RR are inherently handled during an assertion evaluation. In effect, if RR suggests failure during validation, the assertion will fail and report these failures.
Instance Attribute Summary
Attributes inherited from Riot::RunnableBlock
Instance Method Summary collapse
-
#run(situation) ⇒ Array<Symbol, String>
Adds RR support to Assertion#run.
Methods inherited from Assertion
#initialize, macros, register_macro
Methods inherited from Riot::RunnableBlock
Constructor Details
This class inherits a constructor from Riot::Assertion
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Riot::Assertion
Instance Method Details
#run(situation) ⇒ Array<Symbol, String>
Adds RR support to Assertion#run. The basic flow is to:
-
run the test as normal
-
ask RR to verify mock results
-
report any errors or return the result of the assertion as normal
-
reset RR so that the next assertion in the context can be verified cleanly.
32 33 34 35 36 37 38 39 40 |
# File 'lib/riot/rr.rb', line 32 def run(situation) result = super situation.verify result rescue ::RR::Errors::RRError => e result.first == :pass ? [:fail, e..gsub(/\n/, " ")] : result ensure situation.reset end |