Class: RR::Integrations::TestUnit1
- Inherits:
-
Object
- Object
- RR::Integrations::TestUnit1
- Defined in:
- lib/rr/integrations/test_unit_1.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Mixin
Instance Method Summary collapse
- #applies? ⇒ Boolean
- #has_test_unit_version? ⇒ Boolean
- #hook(test_case_class = ::Test::Unit::TestCase) ⇒ Object
- #name ⇒ Object
- #test_unit_just_wraps_minitest? ⇒ Boolean
Instance Method Details
#applies? ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/rr/integrations/test_unit_1.rb', line 14 def applies? defined?(::Test::Unit) && defined?(::Test::Unit::TestCase) && !has_test_unit_version? && !test_unit_just_wraps_minitest? end |
#has_test_unit_version? ⇒ Boolean
53 54 55 56 57 58 |
# File 'lib/rr/integrations/test_unit_1.rb', line 53 def has_test_unit_version? require 'test/unit/version' true rescue LoadError false end |
#hook(test_case_class = ::Test::Unit::TestCase) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rr/integrations/test_unit_1.rb', line 21 def hook(test_case_class = ::Test::Unit::TestCase) test_case_class.class_eval do include RR::Adapters::RRMethods include Mixin unless instance_methods.detect {|method_name| method_name.to_sym == :setup_with_rr } alias_method :setup_without_rr, :setup def setup_with_rr setup_without_rr RR.reset RR.trim_backtrace = true RR.overridden_error_class = ::Test::Unit::AssertionFailedError end alias_method :setup, :setup_with_rr alias_method :teardown_without_rr, :teardown def teardown_with_rr RR.verify ensure teardown_without_rr end alias_method :teardown, :teardown_with_rr end end end |
#name ⇒ Object
10 11 12 |
# File 'lib/rr/integrations/test_unit_1.rb', line 10 def name 'Test::Unit 1' end |
#test_unit_just_wraps_minitest? ⇒ Boolean
47 48 49 50 51 |
# File 'lib/rr/integrations/test_unit_1.rb', line 47 def test_unit_just_wraps_minitest? defined?(::Test::Unit::TestCase) && defined?(::MiniTest::Unit::TestCase) && ::Test::Unit::TestCase < ::MiniTest::Unit::TestCase end |