aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-01-30 12:48:13 -0500
committerGitHub <noreply@github.com>2017-01-30 12:48:13 -0500
commit341fab88a3605705a4a7c96c43e1f8c17f719607 (patch)
tree01211b1329e31a56955a81a0a4832f087b5caa93 /railties/test
parentede6673f9b8ea9567e300a6bd68ba14f48651c08 (diff)
parent4ed0f366892a422dd81a50ebe0552d1b8caf0d93 (diff)
downloadrails-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.rb11
-rw-r--r--railties/test/generators/plugin_test_runner_test.rb11
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"