2 require 'test/unit/deprecate'
5 module Test::Unit # patch up bastards that that extend improperly.
6 if defined? Assertions then
7 warn "ARGH! someone defined Test::Unit::Assertions rather than requiring"
8 CRAP_ASSERTIONS = Assertions
9 remove_const :Assertions
11 # this will break on junit and rubinius... *sigh*
12 ObjectSpace.each_object(Module) do |offender|
13 offender.send :include, ::Mini::Assertions if offender < CRAP_ASSERTIONS
16 Test::Unit::TestCase.send :include, CRAP_ASSERTIONS
19 Assertions = ::Mini::Assertions
23 mod.send :include, Test::Unit::CRAP_ASSERTIONS
24 end if defined? Test::Unit::CRAP_ASSERTIONS
29 module Assertions # deprecations
30 tu_deprecate :assert_nothing_thrown, :assert_nothing_raised # 2009-06-01
31 tu_deprecate :assert_raise, :assert_raises # 2010-06-01
32 tu_deprecate :assert_not_equal, :refute_equal # 2009-06-01
33 tu_deprecate :assert_no_match, :refute_match # 2009-06-01
34 tu_deprecate :assert_not_nil, :refute_nil # 2009-06-01
35 tu_deprecate :assert_not_same, :refute_same # 2009-06-01
37 def assert_nothing_raised _ = :ignored # 2009-06-01
38 self.class.tu_deprecation_warning :assert_nothing_raised
42 raise Mini::Assertion, exception_details(e, "Exception raised:")
45 def build_message(user_message, template_message, *args) # 2009-06-01
46 self.class.tu_deprecation_warning :build_message
48 user_message += ' ' unless user_message.empty?
49 msg = template_message.split(/<\?>/).zip(args.map { |o| o.inspect })
50 user_message + msg.join