Permalink
Browse files

Define the configuration at Active Support

  • Loading branch information...
Rafael Mendonça França
Rafael Mendonça França committed Sep 11, 2014
1 parent 8edb5ee commit 53e877f7d9291b2bf0b8c425f9e32ef35829f35b
@@ -70,6 +70,16 @@ def self.eager_load!
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"
@@ -12,22 +12,18 @@
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 @@ def test_order
"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!
@@ -1,3 +1,4 @@
+require 'active_support'
require 'active_support/testing/autorun'
require 'rails/configuration'
require 'active_support/test_case'
@@ -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'

2 comments on commit 53e877f

@jonleighton

This comment has been minimized.

Show comment
Hide comment
@jonleighton

jonleighton Feb 7, 2015

Member

@rafaelfranca FWIW the implication of this change is that whereas it was previously ok to just require active_support/test_case, it is now necessary to require active_support explicitly too. It broke Spring's tests: rails/spring@a3daa74 Not a massive issue but thought I'd point it out in case you want to add the active_support require into active_support/test_case.

Member

jonleighton replied Feb 7, 2015

@rafaelfranca FWIW the implication of this change is that whereas it was previously ok to just require active_support/test_case, it is now necessary to require active_support explicitly too. It broke Spring's tests: rails/spring@a3daa74 Not a massive issue but thought I'd point it out in case you want to add the active_support require into active_support/test_case.

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Feb 7, 2015

Member

Ah yeah. I was in doubt when I did this change. Our guidelines says we always have to require the top level file of a framework when want to cherry-pick specific files. This is why I didn't add the require in active_support/test_case.

Our documentation already explain this guideline http://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support

Member

rafaelfranca replied Feb 7, 2015

Ah yeah. I was in doubt when I did this change. Our guidelines says we always have to require the top level file of a framework when want to cherry-pick specific files. This is why I didn't add the require in active_support/test_case.

Our documentation already explain this guideline http://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support

Please sign in to comment.