diff options
author | Tsukuru Tanimichi <info+git@ttanimichi.com> | 2018-05-08 16:31:47 +0900 |
---|---|---|
committer | Tsukuru Tanimichi <info+git@ttanimichi.com> | 2018-05-16 20:24:57 +0900 |
commit | 7b0a316f2db449cfebe9897c74160378f9e4dc85 (patch) | |
tree | 218079430214488f3bab9d30f591c4d675e6e22c /railties/test | |
parent | bfe4248c78ce6e93ebba8c7b9ada1c68cd79bb85 (diff) | |
download | rails-7b0a316f2db449cfebe9897c74160378f9e4dc85.tar.gz rails-7b0a316f2db449cfebe9897c74160378f9e4dc85.tar.bz2 rails-7b0a316f2db449cfebe9897c74160378f9e4dc85.zip |
Don't generate yarn's contents in `app:update` task if it's skipped
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index f73747208b..3cb7d66bbb 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -296,6 +296,27 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_app_update_does_not_generate_yarn_contents_when_bin_yarn_is_not_used + app_root = File.join(destination_root, "myapp") + run_generator [app_root, "--skip-yarn"] + + stub_rails_application(app_root) do + generator = Rails::Generators::AppGenerator.new ["rails"], { update: true, skip_yarn: true }, { destination_root: app_root, shell: @shell } + generator.send(:app_const) + quietly { generator.send(:update_bin_files) } + + assert_no_file "#{app_root}/bin/yarn" + + assert_file "#{app_root}/bin/setup" do |content| + assert_no_match(/system\('bin\/yarn'\)/, content) + end + + assert_file "#{app_root}/bin/update" do |content| + assert_no_match(/system\('bin\/yarn'\)/, content) + end + end + end + def test_app_update_does_not_generate_assets_initializer_when_skip_sprockets_is_given app_root = File.join(destination_root, "myapp") run_generator [app_root, "--skip-sprockets"] |