diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-03-22 19:19:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 19:19:16 -0400 |
commit | 36334bf989a6a3e3b7254804d6c7f6227e2a98e9 (patch) | |
tree | baf3b878079ba3f0a16112ae483fb257b3216482 /railties/test | |
parent | 5e3ddf628397b8f3e88d7c3114d060e06289ac4c (diff) | |
parent | 9bc6178e008714828969dcaf1cfde8f62dc9d41f (diff) | |
download | rails-36334bf989a6a3e3b7254804d6c7f6227e2a98e9.tar.gz rails-36334bf989a6a3e3b7254804d6c7f6227e2a98e9.tar.bz2 rails-36334bf989a6a3e3b7254804d6c7f6227e2a98e9.zip |
Merge pull request #28527 from rst/fix_runner_argv_28515
Correctly reset ARGV for "rails runner `CODE' arg arg arg..."
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/runner_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/test/application/runner_test.rb b/railties/test/application/runner_test.rb index 7d058f6ee6..0c45bc398a 100644 --- a/railties/test/application/runner_test.rb +++ b/railties/test/application/runner_test.rb @@ -35,6 +35,14 @@ module ApplicationTests assert_match "42", Dir.chdir(app_path) { `bin/rails runner "puts User.count"` } end + def test_should_set_argv_when_running_code + output = Dir.chdir(app_path) { + # Both long and short args, at start and end of ARGV + `bin/rails runner "puts ARGV.join(',')" --foo a1 -b a2 a3 --moo` + } + assert_equal "--foo,a1,-b,a2,a3,--moo", output.chomp + end + def test_should_run_file app_file "bin/count_users.rb", <<-SCRIPT puts User.count |