From 53e877f7d9291b2bf0b8c425f9e32ef35829f35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 11 Sep 2014 00:54:43 -0300 Subject: Define the configuration at Active Support --- activesupport/lib/active_support.rb | 10 ++++++++++ activesupport/lib/active_support/test_case.rb | 17 +++++++---------- .../test/configuration/middleware_stack_proxy_test.rb | 1 + railties/test/isolation/abstract_unit.rb | 1 + 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' -- cgit v1.2.3