From 6ffb29d24e05abbd9ffe3ea974140d6c70221807 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 12 Aug 2014 19:30:05 +0900 Subject: users_dont_suck_but_only_we_suck_and_only_our_tests_are_order_dependent! Calling ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! in AS::TestCase makes everyone's tests order dependent, which should never be done by the framework. --- actionmailer/test/abstract_unit.rb | 5 +++++ actionpack/test/abstract_unit.rb | 5 +++++ actionview/test/abstract_unit.rb | 5 +++++ activemodel/test/cases/helper.rb | 5 +++++ activerecord/test/cases/helper.rb | 5 +++++ activesupport/lib/active_support/test_case.rb | 4 ---- activesupport/test/abstract_unit.rb | 5 +++++ railties/test/abstract_unit.rb | 4 ++++ 8 files changed, 34 insertions(+), 4 deletions(-) diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 98d266bd73..b07d8c7087 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -51,3 +51,8 @@ def jruby_skip(message = '') end require 'mocha/setup' # FIXME: stop using mocha + +# FIXME: we have tests that depend on run order, we should fix that and +# remove this method call. +require 'active_support/test_case' +ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 4e17d57dad..08f8f64123 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -497,3 +497,8 @@ if ActiveSupport::Testing::Isolation.forking_env? && PROCESS_COUNT > 0 # Use N processes (N defaults to 4) Minitest.parallel_executor = ForkingExecutor.new(PROCESS_COUNT) end + +# FIXME: we have tests that depend on run order, we should fix that and +# remove this method call. +require 'active_support/test_case' +ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb index d60712255b..4cc4cd2d3e 100644 --- a/actionview/test/abstract_unit.rb +++ b/actionview/test/abstract_unit.rb @@ -340,3 +340,8 @@ def jruby_skip(message = '') end require 'mocha/setup' # FIXME: stop using mocha + +# FIXME: we have tests that depend on run order, we should fix that and +# remove this method call. +require 'active_support/test_case' +ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb index 804e0c24f6..75cf90d7cd 100644 --- a/activemodel/test/cases/helper.rb +++ b/activemodel/test/cases/helper.rb @@ -13,3 +13,8 @@ I18n.enforce_available_locales = false require 'active_support/testing/autorun' require 'mocha/setup' # FIXME: stop using mocha + +# FIXME: we have tests that depend on run order, we should fix that and +# remove this method call. +require 'active_support/test_case' +ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 6a8aff4b69..9aa1281e9d 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -201,3 +201,8 @@ module InTimeZone end require 'mocha/setup' # FIXME: stop using mocha + +# FIXME: we have tests that depend on run order, we should fix that and +# remove this method call. +require 'active_support/test_case' +ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index a6a878140c..a456f731e1 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -22,10 +22,6 @@ module ActiveSupport yield if $tags[tag] end - # FIXME: we have tests that depend on run order, we should fix that and - # remove this method call. - self.i_suck_and_my_tests_are_order_dependent! - include ActiveSupport::Testing::TaggedLogging include ActiveSupport::Testing::SetupAndTeardown include ActiveSupport::Testing::Assertions diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index 7ffcae6007..e29a248aa0 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -38,3 +38,8 @@ def jruby_skip(message = '') end require 'mocha/setup' # FIXME: stop using mocha + +# FIXME: we have tests that depend on run order, we should fix that and +# remove this method call. +require 'active_support/test_case' +ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index b6533a5fb2..1b0b9f3aa5 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -28,6 +28,10 @@ def jruby_skip(message = '') end class ActiveSupport::TestCase + # FIXME: we have tests that depend on run order, we should fix that and + # remove this method call. + self.i_suck_and_my_tests_are_order_dependent! + private unless defined?(:capture) -- cgit v1.2.3