Permalink
Browse files

Merge pull request #27388 from maclover7/jm-argv

`ARGV.shift` before calling Rails generators
  • Loading branch information...
eileencodes committed Dec 19, 2016
2 parents 79b6a25 + fa69b2c commit 6e6b00f3423f0e79fb0078dada1096da54bb06a8
@@ -14,6 +14,8 @@ def perform(*)
require_application_and_environment!
load_generators
ARGV.shift
Rails::Generators.invoke generator, args, behavior: :invoke, destination_root: Rails::Command.root
end
end
@@ -169,5 +169,20 @@ def with_bare_config
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

0 comments on commit 6e6b00f

Please sign in to comment.