class RR::Integrations::MiniTest4

Public Instance Methods

applies?() click to toggle source
# File lib/rr/integrations/minitest_4.rb, line 14
def applies?
  mt_version < 5
rescue NameError
  false
end
assertion_error_class() click to toggle source
# File lib/rr/integrations/minitest_4.rb, line 24
def assertion_error_class
  ::MiniTest::Assertion
end
hook() click to toggle source
# File lib/rr/integrations/minitest_4.rb, line 36
def hook
  assertion_error_class = self.assertion_error_class
  test_case_class.class_eval do
    include RR::Adapters::RRMethods
    include Mixin

    unless instance_methods.any? { |method_name| method_name.to_sym == :setup_with_rr }
      alias_method :setup_without_rr, :setup
      define_method(:setup_with_rr) do
        setup_without_rr
        RR.reset
        RR.trim_backtrace = true
        RR.overridden_error_class = assertion_error_class
      end
      alias_method :setup, :setup_with_rr

      alias_method :teardown_without_rr, :teardown
      define_method(:teardown_with_rr) do
        begin
          RR.verify
        ensure
          teardown_without_rr
        end
      end
      alias_method :teardown, :teardown_with_rr
    end
  end
end
mt_version() click to toggle source
# File lib/rr/integrations/minitest_4.rb, line 32
def mt_version
  version_constant.split('.')[0].to_i
end
name() click to toggle source
# File lib/rr/integrations/minitest_4.rb, line 10
def name
  'MiniTest 4'
end
test_case_class() click to toggle source
# File lib/rr/integrations/minitest_4.rb, line 20
def test_case_class
  ::MiniTest::Unit::TestCase
end
version_constant() click to toggle source
# File lib/rr/integrations/minitest_4.rb, line 28
def version_constant
  ::MiniTest::Unit::VERSION
end