Module: Test::Unit::RR::Adapter
Class Method Summary collapse
Instance Method Summary collapse
- #assert_received(subject, &block) ⇒ Object
-
#assert_rr { ... } ⇒ Object
Verify double declarations by RR in block.
Class Method Details
.included(mod) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/test/unit/rr.rb', line 30 def included(mod) ::RR.trim_backtrace = true mod.module_eval do setup :before => :prepend def setup_rr ::RR.reset end cleanup :after => :append def cleanup_rr ::RR.verify end exception_handler do |test_case, exception| target_p = exception.is_a?(::RR::Errors::RRError) if target_p test_case.problem_occurred test_case.add_failure(exception., exception.backtrace) end handled = target_p handled end end end |
Instance Method Details
#assert_received(subject, &block) ⇒ Object
56 57 58 |
# File 'lib/test/unit/rr.rb', line 56 def assert_received(subject, &block) block.call(received(subject)).call end |
#assert_rr { ... } ⇒ Object
Verify double declarations by RR in block. It is useful to clear your double declarations scope.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/test/unit/rr.rb', line 84 def assert_rr begin ::RR.verify ensure ::RR.reset end result = yield begin ::RR.verify ensure ::RR.reset end result end |