Add minitest5 patch

f38
Josef Stribny 11 years ago
parent 39793c7c35
commit ea2f85a834

@ -0,0 +1,44 @@
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
Loading…
Cancel
Save