From bd0ca39564bb2fc263c7a74a27d5f063c68b4dd8 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 4 Oct 2018 13:45:53 +0900 Subject: Add `skip-webpack-install` option This option is useful when want to check only the files generated by `rails new`, or if want to do something before `webpacker:install`. --- railties/test/generators/app_generator_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index cd6bdd11c0..59fc2fcf96 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -825,6 +825,20 @@ 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"] -- cgit v1.2.3