diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-04-19 20:35:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-19 20:35:04 -0400 |
commit | e8b4a927340183acba7fd0a2c3864afc2388a9aa (patch) | |
tree | 4d1623d35c470b6c7ada643fb215c9b278f6c193 /railties | |
parent | 0871e5e5c1e6151a7ed3bdf7b22209ac11532b31 (diff) | |
parent | a6d907e5880e15c641fc457f7e96187fe1e8509d (diff) | |
download | rails-e8b4a927340183acba7fd0a2c3864afc2388a9aa.tar.gz rails-e8b4a927340183acba7fd0a2c3864afc2388a9aa.tar.bz2 rails-e8b4a927340183acba7fd0a2c3864afc2388a9aa.zip |
Merge pull request #28708 from y-yagi/dont_generate_system_test_files
Don't generate system test files if `skip_system_test` option is specified
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/application.rb | 4 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index d5d214052f..0b1d22228e 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -34,6 +34,10 @@ module <%= app_const_base %> # Middleware like session, flash, cookies can be added back manually. # Skip views, helpers and assets when generating a new resource. config.api_only = true +<%- elsif !depends_on_system_test? -%> + + # Don't generate system test files. + config.generators.system_tests = nil <%- end -%> end end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index d3e131db94..8a51beb380 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -451,6 +451,17 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_does_not_generate_system_test_files_if_skip_system_test_is_given + run_generator [destination_root, "--skip_system_test"] + + Dir.chdir(destination_root) do + quietly { `./bin/rails g scaffold User` } + + assert_no_file("test/application_system_test_case.rb") + assert_no_file("test/system/users_test.rb") + end + end + def test_generator_if_api_is_given run_generator [destination_root, "--api"] assert_file "Gemfile" do |content| |