Skip to content

Commit

Permalink
Merge pull request #28708 from y-yagi/dont_generate_system_test_files
Browse files Browse the repository at this point in the history
Don't generate system test files if `skip_system_test` option is specified
  • Loading branch information
rafaelfranca committed Apr 20, 2017
2 parents 0871e5e + a6d907e commit e8b4a92
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Expand Up @@ -34,6 +34,10 @@ class Application < Rails::Application
# 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
11 changes: 11 additions & 0 deletions railties/test/generators/app_generator_test.rb
Expand Up @@ -451,6 +451,17 @@ def test_generator_if_skip_system_test_is_given
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|
Expand Down

0 comments on commit e8b4a92

Please sign in to comment.