diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-12-16 20:10:21 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-12-17 14:01:25 -0500 |
commit | fa69b2c03582f5817572050a4373e365d9071b5d (patch) | |
tree | 0f53d11d1d0431f59ac04f2f39e8f6d0222a36ef /railties/test/application | |
parent | e3802f961756aac58d9b4392bf2e73813b09f469 (diff) | |
download | rails-fa69b2c03582f5817572050a4373e365d9071b5d.tar.gz rails-fa69b2c03582f5817572050a4373e365d9071b5d.tar.bz2 rails-fa69b2c03582f5817572050a4373e365d9071b5d.zip |
`ARGV.shift` before calling Rails generators
Gems like rspec-rails depend on `ARGV` being shifted, and `scaffold`
(for example) not being the first item in `ARGV`. This should allow
rspec-rails to be passing on Rails master.
Diffstat (limited to 'railties/test/application')
-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 |