diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2016-10-21 14:44:17 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2016-10-21 14:44:17 -0700 |
commit | b6f935bbf9b8470b370ea613dc61218849aabf89 (patch) | |
tree | 74787a9bcb7eb891e06398f82cc88989ed8550cc | |
parent | 797f1dd63c68eb44c1af358d377cfef271e685c5 (diff) | |
download | rails-b6f935bbf9b8470b370ea613dc61218849aabf89.tar.gz rails-b6f935bbf9b8470b370ea613dc61218849aabf89.tar.bz2 rails-b6f935bbf9b8470b370ea613dc61218849aabf89.zip |
Use `on_load` to trigger commandline processing code
We need to use on_load so that plugins will get the same functionality
-rw-r--r-- | activesupport/lib/active_support/test_case.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/commands/test/test_command.rb | 5 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/railtie.rb | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 1c599b8851..3de4ccc1da 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -65,5 +65,7 @@ module ActiveSupport alias :assert_not_predicate :refute_predicate alias :assert_not_respond_to :refute_respond_to alias :assert_not_same :refute_same + + ActiveSupport.run_load_hooks(:active_support_test_case, self) end end diff --git a/railties/lib/rails/commands/test/test_command.rb b/railties/lib/rails/commands/test/test_command.rb index e97b9cbbba..1b2e3af9cc 100644 --- a/railties/lib/rails/commands/test/test_command.rb +++ b/railties/lib/rails/commands/test/test_command.rb @@ -1,6 +1,5 @@ require "rails/command" require "rails/test_unit/minitest_plugin" -require "rails/test_unit/line_filtering" module Rails module Command @@ -12,10 +11,6 @@ module Rails def perform(*) $LOAD_PATH << Rails::Command.root.join("test") - # Add test line filtering support for running test by line number - # via the command line. - ActiveSupport::TestCase.extend Rails::LineFiltering - Minitest.run_via[:rails] = true require "active_support/testing/autorun" diff --git a/railties/lib/rails/test_unit/railtie.rb b/railties/lib/rails/test_unit/railtie.rb index ec91673e40..746120e6a1 100644 --- a/railties/lib/rails/test_unit/railtie.rb +++ b/railties/lib/rails/test_unit/railtie.rb @@ -1,3 +1,5 @@ +require "rails/test_unit/line_filtering" + if defined?(Rake.application) && Rake.application.top_level_tasks.grep(/^(default$|test(:|$))/).any? ENV["RAILS_ENV"] ||= "test" end @@ -11,6 +13,12 @@ module Rails c.integration_tool :test_unit end + initializer "test_unit.line_filtering" do + ActiveSupport.on_load(:active_support_test_case) { + ActiveSupport::TestCase.extend Rails::LineFiltering + } + end + rake_tasks do load "rails/test_unit/testing.rake" end |