diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-12-28 11:57:02 +0200 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-12-28 11:57:02 +0200 |
commit | a7567068465a76c3d5e12dc04d11f2c434d2c017 (patch) | |
tree | 2317a15a607dd085579d795e18e77ff438b3d05d /railties | |
parent | e4b6495fd14cfcae7f101821ebf296c75ceca996 (diff) | |
download | rails-a7567068465a76c3d5e12dc04d11f2c434d2c017.tar.gz rails-a7567068465a76c3d5e12dc04d11f2c434d2c017.tar.bz2 rails-a7567068465a76c3d5e12dc04d11f2c434d2c017.zip |
Add `--skip-action-mailbox` option to `rails new`
Related to https://github.com/rails/rails/commit/ddaf06779aa51d5d1ca462c21c53f2ed169a0d2f
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 5 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 10 | ||||
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 4 |
3 files changed, 18 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 1d79df4957..1fc14d196a 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -44,6 +44,9 @@ module Rails default: false, desc: "Skip Action Mailer files" + class_option :skip_action_mailbox, type: :boolean, default: false, + desc: "Skip Action Mailbox files" + class_option :skip_active_record, type: :boolean, aliases: "-O", default: false, desc: "Skip Active Record files" @@ -231,7 +234,7 @@ module Rails end def skip_action_mailbox? # :doc: - options[:skip_active_record] + options[:skip_action_mailbox] || options[:skip_active_record] end class GemfileEntry < Struct.new(:name, :version, :comment, :options, :commented_out) diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 154cd3e80c..c7a9803adf 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -435,6 +435,16 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_no_file "#{app_root}/config/storage.yml" end + def test_generator_when_skip_action_mailbox_is_given + run_generator [destination_root, "--skip-action-mailbox"] + assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']action_mailbox\/engine["']/ + end + + def test_generator_skips_action_mailbox_when_skip_active_record_is_given + run_generator [destination_root, "--skip-active-record"] + assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']action_mailbox\/engine["']/ + end + def test_app_update_does_not_change_config_target_version run_generator diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index 7441ab0603..94f69277f5 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -127,6 +127,7 @@ module SharedGeneratorTests "--skip-active-record", "--skip-active-storage", "--skip-action-mailer", + "--skip-action-mailbox", "--skip-action-cable", "--skip-sprockets" ] @@ -138,6 +139,9 @@ module SharedGeneratorTests assert_file "#{application_path}/config/application.rb", /^# require\s+["']active_storage\/engine["']/ assert_file "#{application_path}/config/application.rb", /^require\s+["']action_controller\/railtie["']/ assert_file "#{application_path}/config/application.rb", /^# require\s+["']action_mailer\/railtie["']/ + unless generator_class.name == "Rails::Generators::PluginGenerator" + assert_file "#{application_path}/config/application.rb", /^# require\s+["']action_mailbox\/engine["']/ + end assert_file "#{application_path}/config/application.rb", /^require\s+["']action_view\/railtie["']/ assert_file "#{application_path}/config/application.rb", /^# require\s+["']action_cable\/engine["']/ assert_file "#{application_path}/config/application.rb", /^# require\s+["']sprockets\/railtie["']/ |