diff --git a/test/test_helper.rb b/test/test_helper.rb index 53f34aa..d24b81f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,25 @@ $KCODE = 'u' if RUBY_VERSION <= '1.9' require 'rubygems' -require 'test/unit' + +# Use minitest if we can, otherwise fallback to test-unit. +begin + require 'minitest/autorun' + TEST_CASE = defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase + + # TODO: Remove these aliases and update tests accordingly. + class TEST_CASE + alias :assert_raise :assert_raises + alias :assert_not_equal :refute_equal + + def assert_nothing_raised(*args) + yield + end + end +rescue LoadError + require 'test/unit' + TEST_CASE = Test::Unit::TestCase +end # Do not load the i18n gem from libraries like active_support. # @@ -17,7 +35,7 @@ require 'mocha' require 'test_declarative' -class Test::Unit::TestCase +class I18n::TestCase < TEST_CASE def teardown I18n.locale = nil I18n.default_locale = :en -- 1.9.3