diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-09-04 07:15:58 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-09-04 07:30:44 +0900 |
commit | c31c705a6a3267578dc0e63aa5aa51b178151861 (patch) | |
tree | 5b6797ede79c829b382d9b0a2e0367810e2290c0 /railties | |
parent | 07bac9ef93d98a1e31cd5b2ce2aabc1e57816604 (diff) | |
download | rails-c31c705a6a3267578dc0e63aa5aa51b178151861.tar.gz rails-c31c705a6a3267578dc0e63aa5aa51b178151861.tar.bz2 rails-c31c705a6a3267578dc0e63aa5aa51b178151861.zip |
Explicitly require `test_unit/reporter` in test helper
If the user used the `bin/test` to execute the test, this file is
automatically loaded, so require is unnecessary.
https://github.com/rails/rails/blob/acea68de026ba657cb65c4dd0fc1f24ba67e1cf8/railties/lib/rails/plugin/test.rb#L4
However, when using `rake test`, an explicit require is required because
the above file is not loaded.
Fixes #30516
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb | 1 | ||||
-rw-r--r-- | railties/test/generators/plugin_test_runner_test.rb | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb b/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb index 2af7e06041..7fa9973931 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +++ b/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb @@ -12,6 +12,7 @@ require "rails/test_help" Minitest.backtrace_filter = Minitest::BacktraceFilter.new <% unless engine? -%> +require "rails/test_unit/reporter" Rails::TestUnitReporter.executable = 'bin/test' <% end -%> diff --git a/railties/test/generators/plugin_test_runner_test.rb b/railties/test/generators/plugin_test_runner_test.rb index 28a76f0617..89c3f1e496 100644 --- a/railties/test/generators/plugin_test_runner_test.rb +++ b/railties/test/generators/plugin_test_runner_test.rb @@ -105,6 +105,12 @@ class PluginTestRunnerTest < ActiveSupport::TestCase capture(:stderr) { run_test_command("test/models/warnings_test.rb -w") }) end + def test_run_rake_test + create_test_file "foo" + result = Dir.chdir(plugin_path) { `rake test TEST=test/foo_test.rb` } + assert_match "1 runs, 1 assertions, 0 failures", result + end + private def plugin_path "#{@destination_root}/bukkits" |