aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafael.franca@plataformatec.com.br>2014-09-11 00:54:43 -0300
committerRafael Mendonça França <rafael.franca@plataformatec.com.br>2014-09-11 00:54:43 -0300
commit53e877f7d9291b2bf0b8c425f9e32ef35829f35b (patch)
tree499c37c195c2d8dcd3fc9c71bfee92f4fc8986a1
parent8edb5eeb360779aad7a45a66818fada98a22b1e2 (diff)
downloadrails-53e877f7d9291b2bf0b8c425f9e32ef35829f35b.tar.gz
rails-53e877f7d9291b2bf0b8c425f9e32ef35829f35b.tar.bz2
rails-53e877f7d9291b2bf0b8c425f9e32ef35829f35b.zip
Define the configuration at Active Support
-rw-r--r--activesupport/lib/active_support.rb10
-rw-r--r--activesupport/lib/active_support/test_case.rb17
-rw-r--r--railties/test/configuration/middleware_stack_proxy_test.rb1
-rw-r--r--railties/test/isolation/abstract_unit.rb1
4 files changed, 19 insertions, 10 deletions
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index ab0054b339..94468240a4 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -70,6 +70,16 @@ module ActiveSupport
NumberHelper.eager_load!
end
+
+ @@test_order = nil
+
+ def self.test_order=(new_order)
+ @@test_order = new_order
+ end
+
+ def self.test_order
+ @@test_order
+ end
end
autoload :I18n, "active_support/i18n"
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 33139320fa..4c3e77b7fd 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -12,22 +12,18 @@ require 'active_support/core_ext/kernel/reporting'
require 'active_support/deprecation'
module ActiveSupport
- class << self
- delegate :test_order, :test_order=, to: :'ActiveSupport::TestCase'
- end
-
class TestCase < ::Minitest::Test
Assertion = Minitest::Assertion
- @@test_order = nil
-
class << self
def test_order=(new_order)
- @@test_order = new_order
+ ActiveSupport.test_order = new_order
end
def test_order
- if @@test_order.nil?
+ test_order = ActiveSupport.test_order
+
+ if test_order.nil?
ActiveSupport::Deprecation.warn "You did not specify a value for the " \
"configuration option 'active_support.test_order'. In Rails 5.0, " \
"the default value of this option will change from `:sorted` to " \
@@ -42,10 +38,11 @@ module ActiveSupport
"Alternatively, you can opt into the future behavior by setting this " \
"option to `:random`."
- @@test_order = :sorted
+ test_order = :sorted
+ self.test_order = test_order
end
- @@test_order
+ test_order
end
alias :my_tests_are_order_dependent! :i_suck_and_my_tests_are_order_dependent!
diff --git a/railties/test/configuration/middleware_stack_proxy_test.rb b/railties/test/configuration/middleware_stack_proxy_test.rb
index 6f3e45f320..d5072614cf 100644
--- a/railties/test/configuration/middleware_stack_proxy_test.rb
+++ b/railties/test/configuration/middleware_stack_proxy_test.rb
@@ -1,3 +1,4 @@
+require 'active_support'
require 'active_support/testing/autorun'
require 'rails/configuration'
require 'active_support/test_case'
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index 0c88cf115c..40469e31d7 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -9,6 +9,7 @@
require 'fileutils'
require 'bundler/setup' unless defined?(Bundler)
+require 'active_support'
require 'active_support/testing/autorun'
require 'active_support/test_case'