New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix skip_system_test not being preserved in update #45648
Fix skip_system_test not being preserved in update #45648
Conversation
Previously running app:update always would template an application.rb file without the `config.generators.system_tests = nil` set, even for applications that previously had it set.
@@ -29,6 +29,7 @@ def generator_options | |||
options[:skip_action_text] = !defined?(ActionText::Engine) | |||
options[:skip_action_cable] = !defined?(ActionCable::Engine) | |||
options[:skip_test] = !defined?(Rails::TestUnitRailtie) | |||
options[:skip_system_test] = Rails.application.config.generators.system_tests.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, options[:skip_system_test]
triggers !depends_on_system_test?
:
rails/railties/lib/rails/generators/app_base.rb
Lines 479 to 481 in 8892100
def depends_on_system_test? | |
!(options[:skip_system_test] || options[:skip_test] || options[:api]) | |
end |
which triggers config.generators.system_tests = nil
:
rails/railties/lib/rails/generators/rails/app/templates/config/application.rb.tt
Lines 47 to 51 in 8892100
<%- elsif !depends_on_system_test? -%> | |
# Don't generate system test files. | |
config.generators.system_tests = nil | |
<%- end -%> |
Thank you, @skipkayhil! ✔️ ✔️ |
Fix skip_system_test not being preserved in update (cherry picked from commit 7548d76)
Backported to @skipkayhil By the way, should we add a regression test, similar to this one? |
Definitely, thanks for the pointer as well! |
Summary
Previously running app:update always would template an application.rb
file without the
config.generators.system_tests = nil
set, even forapplications that previously had it set.