Skip to content

Commit c6d95da

Browse files
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.
1 parent 66b7c05 commit c6d95da

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

gemfiles/Gemfile.rails-4.1.x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
22

33
gemspec :path => '..'
44

5-
gem 'activesupport', '~> 4.0.0'
5+
gem 'activesupport', '~> 4.1.0'
66
gem 'mocha'
77
gem 'test_declarative'
88
gem 'rufus-tokyo'

gemfiles/Gemfile.rails-4.1.x.lock

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@ PATH
66
GEM
77
remote: https://rubygems.org/
88
specs:
9-
activesupport (4.0.5)
9+
activesupport (4.1.1)
1010
i18n (~> 0.6, >= 0.6.9)
11-
minitest (~> 4.2)
12-
multi_json (~> 1.3)
11+
json (~> 1.7, >= 1.7.7)
12+
minitest (~> 5.1)
1313
thread_safe (~> 0.1)
14-
tzinfo (~> 0.3.37)
14+
tzinfo (~> 1.1)
1515
ffi (1.9.3)
16+
json (1.8.1)
1617
metaclass (0.0.4)
17-
minitest (4.7.5)
18+
minitest (5.3.3)
1819
mocha (1.0.0)
1920
metaclass (~> 0.0.1)
20-
multi_json (1.10.0)
2121
rake (10.3.1)
2222
rufus-tokyo (1.0.7)
2323
test_declarative (0.0.5)
2424
thread_safe (0.3.3)
25-
tzinfo (0.3.39)
25+
tzinfo (1.1.0)
26+
thread_safe (~> 0.1)
2627

2728
PLATFORMS
2829
ruby
2930

3031
DEPENDENCIES
31-
activesupport (~> 4.0.0)
32+
activesupport (~> 4.1.0)
3233
ffi
3334
i18n!
3435
mocha

test/test_helper.rb

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
$KCODE = 'u' if RUBY_VERSION <= '1.9'
22

33
require 'rubygems'
4-
require 'test/unit'
4+
5+
# Use minitest if we can, otherwise fallback to test-unit.
6+
begin
7+
require 'minitest/autorun'
8+
TEST_CASE = defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase
9+
10+
# TODO: Remove these aliases and update tests accordingly.
11+
class TEST_CASE
12+
alias :assert_raise :assert_raises
13+
alias :assert_not_equal :refute_equal
14+
15+
def assert_nothing_raised(*args)
16+
yield
17+
end
18+
end
19+
rescue LoadError
20+
require 'test/unit'
21+
TEST_CASE = Test::Unit::TestCase
22+
end
523

624
# Do not load the i18n gem from libraries like active_support.
725
#
@@ -17,7 +35,7 @@ def gem(gem_name, *version_requirements)
1735
require 'mocha/setup'
1836
require 'test_declarative'
1937

20-
class I18n::TestCase < Test::Unit::TestCase
38+
class I18n::TestCase < TEST_CASE
2139
def self.setup_rufus_tokyo
2240
require 'rufus/tokyo'
2341
rescue LoadError => e

0 commit comments

Comments
 (0)