From 02d2d3cf699f2c8a1e078d5e5e72f76ec6706da6 Mon Sep 17 00:00:00 2001 From: Stephen Blackstone Date: Tue, 5 Jan 2016 22:53:38 -0500 Subject: Provide a better error message if a user mistypes the name of script with runner Add tests for detecting bad options for runner --- railties/test/application/runner_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'railties/test/application') diff --git a/railties/test/application/runner_test.rb b/railties/test/application/runner_test.rb index 0c180339b4..9f15ce5e85 100644 --- a/railties/test/application/runner_test.rb +++ b/railties/test/application/runner_test.rb @@ -74,6 +74,16 @@ module ApplicationTests assert_match "development", Dir.chdir(app_path) { `bin/rails runner "puts Rails.env"` } end + def test_runner_detects_syntax_errors + Dir.chdir(app_path) { `bin/rails runner "puts 'hello world" 2>&1` } + refute $?.success? + end + + def test_runner_detects_bad_script_name + Dir.chdir(app_path) { `bin/rails runner "iuiqwiourowe" 2>&1` } + refute $?.success? + end + def test_environment_with_rails_env with_rails_env "production" do assert_match "production", Dir.chdir(app_path) { `bin/rails runner "puts Rails.env"` } -- cgit v1.2.3