Skip to content

Commit

Permalink
Fix Gemfile dependencies for Rails 4.1 and use Minitest if available
Browse files Browse the repository at this point in the history
Fallback to test/unit in case minitest is not available, which should be
necessary for Ruby 1.8.7 only.
  • Loading branch information
carlosantoniodasilva committed May 28, 2014
1 parent 66b7c05 commit c6d95da
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.rails-4.1.x
Expand Up @@ -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'
Expand Down
17 changes: 9 additions & 8 deletions gemfiles/Gemfile.rails-4.1.x.lock
Expand Up @@ -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
Expand Down
22 changes: 20 additions & 2 deletions 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.
#
Expand All @@ -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
Expand Down

0 comments on commit c6d95da

Please sign in to comment.