Module: ActiveSupport::Testing::SetupAndTeardown::ForClassicTestUnit
- Defined in:
- lib/active_support/testing/setup_and_teardown.rb
Constant Summary collapse
- PASSTHROUGH_EXCEPTIONS =
For compatibility with Ruby < 1.8.6
Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS rescue [NoMemoryError, SignalException, Interrupt, SystemExit]
Instance Method Summary collapse
-
#run(result) {|Test::Unit::TestCase::STARTED, name| ... } ⇒ Object
This redefinition is unfortunate but test/unit shows us no alternative.
Instance Method Details
#run(result) {|Test::Unit::TestCase::STARTED, name| ... } ⇒ Object
This redefinition is unfortunate but test/unit shows us no alternative. Doubly unfortunate: hax to support Mocha’s hax.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/active_support/testing/setup_and_teardown.rb', line 56 def run(result) return if @method_name.to_s == "default_test" mocha_counter = retrieve_mocha_counter(result) yield(Test::Unit::TestCase::STARTED, name) @_result = result begin begin _run_setup_callbacks do setup __send__(@method_name) mocha_verify(mocha_counter) if mocha_counter end rescue Mocha::ExpectationError => e add_failure(e., e.backtrace) rescue Test::Unit::AssertionFailedError => e add_failure(e., e.backtrace) rescue Exception => e raise if PASSTHROUGH_EXCEPTIONS.include?(e.class) add_error(e) ensure begin teardown _run_teardown_callbacks rescue Test::Unit::AssertionFailedError => e add_failure(e., e.backtrace) rescue Exception => e raise if PASSTHROUGH_EXCEPTIONS.include?(e.class) add_error(e) end end ensure mocha_teardown if mocha_counter end result.add_run yield(Test::Unit::TestCase::FINISHED, name) end |