diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-10-09 15:52:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-09 15:52:14 -0400 |
commit | 3101a4136bd62787e252d2658eee23001036fa0f (patch) | |
tree | 02c2e7b447cee8c95036ae7a64032aa3819c89bb /railties/test/generators | |
parent | 168a9728dd00069efe04fec4b59d29e3752fbfb3 (diff) | |
parent | 9195cdb7cd3e630d7c8d155b85d6434a0745d08b (diff) | |
download | rails-3101a4136bd62787e252d2658eee23001036fa0f.tar.gz rails-3101a4136bd62787e252d2658eee23001036fa0f.tar.bz2 rails-3101a4136bd62787e252d2658eee23001036fa0f.zip |
Merge pull request #34071 from y-yagi/skip_webpacker_install
Add `skip-webpack-install` option
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 18 | ||||
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 8 |
2 files changed, 20 insertions, 6 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index cd6bdd11c0..a1d91a2f98 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 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'/) @@ -825,8 +825,22 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_gem "webpacker" end + def test_skip_webpack_install + command_check = -> command do + if command == "webpacker:install" + assert false, "webpacker:install expected not to be called." + end + end + + generator([destination_root], skip_webpack_install: true).stub(:rails_command, command_check) do + quietly { generator.invoke_all } + end + + assert_gem "webpacker" + end + def test_generator_if_skip_turbolinks_is_given - run_generator [destination_root, "--skip-turbolinks", "--no-skip-javascript"] + run_generator [destination_root, "--skip-turbolinks"] 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..fc654e867b 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 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 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"] 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"] assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']active_storage\/engine["']/ |