aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTsukuru Tanimichi <info+git@ttanimichi.com>2017-11-29 18:44:46 +0900
committerTsukuru Tanimichi <info+git@ttanimichi.com>2017-12-04 14:32:44 +0900
commit915f0e682cecf80080914d0390ce22eb06f41470 (patch)
tree6f8979804d6ad6d727d2fa27648e551994d94953
parentf128177eb701373326a3ae91651bf291d0fd245c (diff)
downloadrails-915f0e682cecf80080914d0390ce22eb06f41470.tar.gz
rails-915f0e682cecf80080914d0390ce22eb06f41470.tar.bz2
rails-915f0e682cecf80080914d0390ce22eb06f41470.zip
Add tests for the `--webpack` option
We probably don't have any tests for the `--webpack` option. related: #27288
-rw-r--r--railties/test/generators/app_generator_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 774fd0f315..c9c85078d4 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -743,6 +743,20 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
+ def test_webpack_option
+ command_check = -> command, *_ do
+ @called ||= 0
+ @called += 1 if command == "webpacker:install"
+ assert_equal 1, @called, "webpacker:install expected to be called once, but was called #{@called} times."
+ end
+
+ generator([destination_root], webpack: 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"]