aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/generators_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application/generators_test.rb')
-rw-r--r--railties/test/application/generators_test.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb
index ee0d697599..e5e557d204 100644
--- a/railties/test/application/generators_test.rb
+++ b/railties/test/application/generators_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "isolation/abstract_unit"
module ApplicationTests
@@ -29,7 +31,7 @@ module ApplicationTests
end
test "allow running plugin new generator inside Rails app directory" do
- FileUtils.cd(rails_root) { `ruby bin/rails plugin new vendor/plugins/bukkits` }
+ rails "plugin", "new", "vendor/plugins/bukkits"
assert File.exist?(File.join(rails_root, "vendor/plugins/bukkits/test/dummy/config/application.rb"))
end
@@ -165,13 +167,14 @@ module ApplicationTests
config.api_only = true
RUBY
- FileUtils.cd(rails_root) { `bin/rails generate mailer notifier foo` }
+ rails "generate", "mailer", "notifier", "foo"
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"
+ require "rails/command"
Rails::Command.const_set("APP_PATH", "rails/all")
FileUtils.cd(rails_root) do
@@ -185,9 +188,13 @@ module ApplicationTests
Rails::Command.send(:remove_const, "APP_PATH")
end
- test "help does not show hidden namespaces" do
+ test "help does not show hidden namespaces and hidden commands" do
FileUtils.cd(rails_root) do
- output = `bin/rails generate --help`
+ output = rails("generate", "--help")
+ assert_no_match "active_record:migration", output
+ assert_no_match "credentials", output
+
+ output = rails("destroy", "--help")
assert_no_match "active_record:migration", output
end
end