diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-01-30 12:48:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 12:48:13 -0500 |
commit | 341fab88a3605705a4a7c96c43e1f8c17f719607 (patch) | |
tree | 01211b1329e31a56955a81a0a4832f087b5caa93 /railties/test | |
parent | ede6673f9b8ea9567e300a6bd68ba14f48651c08 (diff) | |
parent | 4ed0f366892a422dd81a50ebe0552d1b8caf0d93 (diff) | |
download | rails-341fab88a3605705a4a7c96c43e1f8c17f719607.tar.gz rails-341fab88a3605705a4a7c96c43e1f8c17f719607.tar.bz2 rails-341fab88a3605705a4a7c96c43e1f8c17f719607.zip |
Merge pull request #27784 from y-yagi/add_warnings_option_to_test_runner
add warnings option to test runner
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/test_runner_test.rb | 11 | ||||
-rw-r--r-- | railties/test/generators/plugin_test_runner_test.rb | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index 0939587960..4e36d126fc 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -536,6 +536,17 @@ module ApplicationTests assert_match "seed=1234", output, "passing TEST= should run selected test" end + def test_warnings_option + app_file "test/models/warnings_test.rb", <<-RUBY + require 'test_helper' + def test_warnings + a = 1 + end + RUBY + assert_match(/warning: assigned but unused variable/, + capture(:stderr) { run_test_command("test/models/warnings_test.rb -w") }) + end + private def run_test_command(arguments = "test/unit/test_test.rb") Dir.chdir(app_path) { `bin/rails t #{arguments}` } diff --git a/railties/test/generators/plugin_test_runner_test.rb b/railties/test/generators/plugin_test_runner_test.rb index 0bdf3b2726..0bdd2a77d2 100644 --- a/railties/test/generators/plugin_test_runner_test.rb +++ b/railties/test/generators/plugin_test_runner_test.rb @@ -92,6 +92,17 @@ class PluginTestRunnerTest < ActiveSupport::TestCase assert_equal 1, result.scan(/1 runs, 1 assertions, 0 failures/).length end + def test_warnings_option + plugin_file "test/models/warnings_test.rb", <<-RUBY + require 'test_helper' + def test_warnings + a = 1 + end + RUBY + assert_match(/warning: assigned but unused variable/, + capture(:stderr) { run_test_command("test/models/warnings_test.rb -w") }) + end + private def plugin_path "#{@destination_root}/bukkits" |