diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2016-12-19 09:20:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-19 09:20:03 -0500 |
commit | 6e6b00f3423f0e79fb0078dada1096da54bb06a8 (patch) | |
tree | dd80f4dde6691744c2b9d7a62d4c816da5772ca1 /railties/test/application/generators_test.rb | |
parent | 79b6a259168caa573e0c96fc0c115c13ab17537d (diff) | |
parent | fa69b2c03582f5817572050a4373e365d9071b5d (diff) | |
download | rails-6e6b00f3423f0e79fb0078dada1096da54bb06a8.tar.gz rails-6e6b00f3423f0e79fb0078dada1096da54bb06a8.tar.bz2 rails-6e6b00f3423f0e79fb0078dada1096da54bb06a8.zip |
Merge pull request #27388 from maclover7/jm-argv
`ARGV.shift` before calling Rails generators
Diffstat (limited to 'railties/test/application/generators_test.rb')
-rw-r--r-- | railties/test/application/generators_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 0153f94504..d75577c5f6 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -169,5 +169,20 @@ module ApplicationTests assert File.exist?(File.join(rails_root, "app/views/notifier_mailer/foo.text.erb")) assert File.exist?(File.join(rails_root, "app/views/notifier_mailer/foo.html.erb")) end + + test "ARGV is mutated as expected" do + require "#{app_path}/config/environment" + Rails::Command.const_set("APP_PATH", "rails/all") + + FileUtils.cd(rails_root) do + ARGV = ["mailer", "notifier", "foo"] + Rails::Command.const_set("ARGV", ARGV) + Rails::Command.invoke :generate, ARGV + + assert_equal ["notifier", "foo"], ARGV + end + + Rails::Command.send(:remove_const, "APP_PATH") + end end end |