Skip to content

Commit 53e877f

Browse files
author
Rafael Mendonça França
committed
Define the configuration at Active Support
1 parent 8edb5ee commit 53e877f

4 files changed

Lines changed: 19 additions & 10 deletions

File tree

activesupport/lib/active_support.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ def self.eager_load!
7070

7171
NumberHelper.eager_load!
7272
end
73+
74+
@@test_order = nil
75+
76+
def self.test_order=(new_order)
77+
@@test_order = new_order
78+
end
79+
80+
def self.test_order
81+
@@test_order
82+
end
7383
end
7484

7585
autoload :I18n, "active_support/i18n"

activesupport/lib/active_support/test_case.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,18 @@
1212
require 'active_support/deprecation'
1313

1414
module ActiveSupport
15-
class << self
16-
delegate :test_order, :test_order=, to: :'ActiveSupport::TestCase'
17-
end
18-
1915
class TestCase < ::Minitest::Test
2016
Assertion = Minitest::Assertion
2117

22-
@@test_order = nil
23-
2418
class << self
2519
def test_order=(new_order)
26-
@@test_order = new_order
20+
ActiveSupport.test_order = new_order
2721
end
2822

2923
def test_order
30-
if @@test_order.nil?
24+
test_order = ActiveSupport.test_order
25+
26+
if test_order.nil?
3127
ActiveSupport::Deprecation.warn "You did not specify a value for the " \
3228
"configuration option 'active_support.test_order'. In Rails 5.0, " \
3329
"the default value of this option will change from `:sorted` to " \
@@ -42,10 +38,11 @@ def test_order
4238
"Alternatively, you can opt into the future behavior by setting this " \
4339
"option to `:random`."
4440

45-
@@test_order = :sorted
41+
test_order = :sorted
42+
self.test_order = test_order
4643
end
4744

48-
@@test_order
45+
test_order
4946
end
5047

5148
alias :my_tests_are_order_dependent! :i_suck_and_my_tests_are_order_dependent!

railties/test/configuration/middleware_stack_proxy_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'active_support'
12
require 'active_support/testing/autorun'
23
require 'rails/configuration'
34
require 'active_support/test_case'

railties/test/isolation/abstract_unit.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
require 'fileutils'
1010

1111
require 'bundler/setup' unless defined?(Bundler)
12+
require 'active_support'
1213
require 'active_support/testing/autorun'
1314
require 'active_support/test_case'
1415

0 commit comments

Comments
 (0)