From 4ed0f366892a422dd81a50ebe0552d1b8caf0d93 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Mon, 23 Jan 2017 15:05:46 +0900 Subject: add warnings option to test runner --- railties/test/application/test_runner_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'railties/test/application') 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}` } -- cgit v1.2.3