From c6d95dafa30253c992047e699b26377669979af0 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 9 May 2014 10:48:45 -0300 Subject: [PATCH] Fix Gemfile dependencies for Rails 4.1 and use Minitest if available Fallback to test/unit in case minitest is not available, which should be necessary for Ruby 1.8.7 only. --- gemfiles/Gemfile.rails-4.1.x | 2 +- gemfiles/Gemfile.rails-4.1.x.lock | 17 +++++++++-------- test/test_helper.rb | 22 ++++++++++++++++++++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/gemfiles/Gemfile.rails-4.1.x b/gemfiles/Gemfile.rails-4.1.x index ac0793d0..8db40a50 100644 --- a/gemfiles/Gemfile.rails-4.1.x +++ b/gemfiles/Gemfile.rails-4.1.x @@ -2,7 +2,7 @@ source 'https://rubygems.org' gemspec :path => '..' -gem 'activesupport', '~> 4.0.0' +gem 'activesupport', '~> 4.1.0' gem 'mocha' gem 'test_declarative' gem 'rufus-tokyo' diff --git a/gemfiles/Gemfile.rails-4.1.x.lock b/gemfiles/Gemfile.rails-4.1.x.lock index 09eefb62..ddf8a1d8 100644 --- a/gemfiles/Gemfile.rails-4.1.x.lock +++ b/gemfiles/Gemfile.rails-4.1.x.lock @@ -6,29 +6,30 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.0.5) + activesupport (4.1.1) i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) ffi (1.9.3) + json (1.8.1) metaclass (0.0.4) - minitest (4.7.5) + minitest (5.3.3) mocha (1.0.0) metaclass (~> 0.0.1) - multi_json (1.10.0) rake (10.3.1) rufus-tokyo (1.0.7) test_declarative (0.0.5) thread_safe (0.3.3) - tzinfo (0.3.39) + tzinfo (1.1.0) + thread_safe (~> 0.1) PLATFORMS ruby DEPENDENCIES - activesupport (~> 4.0.0) + activesupport (~> 4.1.0) ffi i18n! mocha diff --git a/test/test_helper.rb b/test/test_helper.rb index 53f34aad..d24b81f3 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 @@ def gem(gem_name, *version_requirements) require 'mocha/setup' require 'test_declarative' -class I18n::TestCase < Test::Unit::TestCase +class I18n::TestCase < TEST_CASE def self.setup_rufus_tokyo require 'rufus/tokyo' rescue LoadError => e