diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-10-04 14:34:29 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-10-09 08:09:10 +0900 |
commit | 7c846d9c730f2d2b54a4ab81ec73b4905c56d193 (patch) | |
tree | 35e34cb4e8030a9388c72e92c04d8477c15341a4 | |
parent | bd0ca39564bb2fc263c7a74a27d5f063c68b4dd8 (diff) | |
download | rails-7c846d9c730f2d2b54a4ab81ec73b4905c56d193.tar.gz rails-7c846d9c730f2d2b54a4ab81ec73b4905c56d193.tar.bz2 rails-7c846d9c730f2d2b54a4ab81ec73b4905c56d193.zip |
Avoid `webpacker:install` if unnecessary
`webpacker:install` also includes execution of yarn, it takes time to execute,
so avoid unnecessary tests.
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/plugin_generator.rb | 1 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 4 | ||||
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 8 |
3 files changed, 7 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index 9ec0ccbe7a..a018a98c53 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -98,6 +98,7 @@ task default: :test opts[:skip_listen] = true opts[:skip_git] = true opts[:skip_turbolinks] = true + opts[:skip_webpack_install] = true opts[:dummy_app] = true invoke Rails::Generators::AppGenerator, diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 59fc2fcf96..90fa89e687 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -113,7 +113,7 @@ class AppGeneratorTest < Rails::Generators::TestCase end def test_assets - run_generator [destination_root, "--no-skip-javascript"] + run_generator [destination_root, "--no-skip-javascript", "--skip-webpack-install"] assert_file("app/views/layouts/application.html.erb", /stylesheet_link_tag\s+'application', media: 'all', 'data-turbolinks-track': 'reload'/) assert_file("app/views/layouts/application.html.erb", /javascript_pack_tag\s+'application', 'data-turbolinks-track': 'reload'/) @@ -840,7 +840,7 @@ class AppGeneratorTest < Rails::Generators::TestCase end def test_generator_if_skip_turbolinks_is_given - run_generator [destination_root, "--skip-turbolinks", "--no-skip-javascript"] + run_generator [destination_root, "--skip-turbolinks", "--no-skip-javascript", "--skip-webpack-install"] assert_no_gem "turbolinks" assert_file "app/views/layouts/application.html.erb" do |content| diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index b766fa1a71..e2f8500ea4 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -27,7 +27,7 @@ module SharedGeneratorTests end def test_skeleton_is_created - run_generator [destination_root, "--no-skip-javascript"] + run_generator [destination_root, "--no-skip-javascript", "--skip-webpack-install"] default_files.each { |path| assert_file path } end @@ -196,7 +196,7 @@ module SharedGeneratorTests end def test_generator_for_active_storage - run_generator [destination_root, "--no-skip-javascript"] + run_generator [destination_root, "--no-skip-javascript", "--skip-webpack-install"] unless generator_class.name == "Rails::Generators::PluginGenerator" assert_file "#{application_path}/app/javascript/packs/application.js" do |content| @@ -226,7 +226,7 @@ module SharedGeneratorTests end def test_generator_if_skip_active_storage_is_given - run_generator [destination_root, "--skip-active-storage", "--no-skip-javascript"] + run_generator [destination_root, "--skip-active-storage", "--no-skip-javascript", "--skip-webpack-install"] assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']active_storage\/engine["']/ @@ -256,7 +256,7 @@ module SharedGeneratorTests end def test_generator_does_not_generate_active_storage_contents_if_skip_active_record_is_given - run_generator [destination_root, "--skip-active-record", "--no-skip-javascript"] + run_generator [destination_root, "--skip-active-record", "--no-skip-javascript", "--skip-webpack-install"] assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']active_storage\/engine["']/ |