aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTsukuru Tanimichi <info+git@ttanimichi.com>2017-12-05 18:43:15 +0900
committerTsukuru Tanimichi <info+git@ttanimichi.com>2017-12-05 18:43:15 +0900
commit6a11b0c1549e88a7ca32a73764d8b6634dc326e2 (patch)
tree00672486a535d05f1a7a6beb37760612f881d646
parentb9fb74514b752df3b707fa420e09dca459a3844f (diff)
downloadrails-6a11b0c1549e88a7ca32a73764d8b6634dc326e2.tar.gz
rails-6a11b0c1549e88a7ca32a73764d8b6634dc326e2.tar.bz2
rails-6a11b0c1549e88a7ca32a73764d8b6634dc326e2.zip
Add more tests for the `--webpack` option
-rw-r--r--railties/test/generators/app_generator_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 68b31148d6..96803db838 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -759,6 +759,25 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_gem "webpacker"
end
+ def test_webpack_option_with_js_framework
+ command_check = -> command, *_ do
+ case command
+ when "webpacker:install"
+ @webpacker ||= 0
+ @webpacker += 1
+ assert_equal 1, @webpacker, "webpacker:install expected to be called once, but was called #{@webpacker} times."
+ when "webpacker:install:react"
+ @react ||= 0
+ @react += 1
+ assert_equal 1, @react, "webpacker:install:react expected to be called once, but was called #{@react} times."
+ end
+ end
+
+ generator([destination_root], webpack: "react").stub(:rails_command, command_check) do
+ quietly { generator.invoke_all }
+ end
+ end
+
def test_generator_if_skip_turbolinks_is_given
run_generator [destination_root, "--skip-turbolinks"]