aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile1
-rw-r--r--activesupport/activesupport.gemspec1
-rw-r--r--activesupport/lib/active_support/test_case.rb6
-rw-r--r--activesupport/lib/active_support/testing/isolation.rb7
-rw-r--r--railties/lib/rails/test_help.rb6
5 files changed, 17 insertions, 4 deletions
diff --git a/Gemfile b/Gemfile
index 806aa9392d..4a1e1fb155 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,6 +18,7 @@ else
end
gem 'i18n', '~> 0.6.11'
+gem 'test-unit', '~> 3.0'
# This needs to be with require false to avoid
# it being automatically loaded by sprockets
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec
index f3c22871e5..e131ca7d68 100644
--- a/activesupport/activesupport.gemspec
+++ b/activesupport/activesupport.gemspec
@@ -22,5 +22,4 @@ Gem::Specification.new do |s|
s.add_dependency('i18n', '~> 0.6', '>= 0.6.4')
s.add_dependency('multi_json', '~> 1.0')
- s.add_dependency('test-unit', '~> 3.0')
end
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 573736ede7..f0f83a747c 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -1,4 +1,8 @@
-require 'test/unit/testcase'
+begin
+ require 'test/unit/testcase'
+rescue LoadError => e
+ raise LoadError, "Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (#{e.message})", e.backtrace
+end
require 'active_support/testing/setup_and_teardown'
require 'active_support/testing/assertions'
require 'active_support/testing/deprecation'
diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb
index 77c04758ba..d762522d29 100644
--- a/activesupport/lib/active_support/testing/isolation.rb
+++ b/activesupport/lib/active_support/testing/isolation.rb
@@ -156,7 +156,12 @@ end
# Only in subprocess for windows / jruby.
if ENV['ISOLATION_TEST']
- require "test/unit/collector/objectspace"
+ begin
+ require "test/unit/collector/objectspace"
+ rescue LoadError => e
+ raise LoadError, "Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (#{e.message})", e.backtrace
+ end
+
class Test::Unit::Collector::ObjectSpace
def include?(test)
super && test.method_name == ENV['ISOLATION_TEST']
diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb
index 2efa25af7e..dc6999b4d5 100644
--- a/railties/lib/rails/test_help.rb
+++ b/railties/lib/rails/test_help.rb
@@ -2,7 +2,11 @@
# so fixtures aren't loaded into that environment
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?
-require 'test/unit'
+begin
+ require 'test/unit'
+rescue LoadError => e
+ raise LoadError, "Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (#{e.message})", e.backtrace
+end
require 'active_support/test_case'
require 'action_controller/test_case'
require 'action_dispatch/testing/integration'