From be1afa79c72a575fd55a62caffdde4675e4a5cac Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Tue, 9 Jan 2024 17:58:40 -0600 Subject: [PATCH] Test specific behavior of javascript:install:webpack This adds test coverage for specific behavior of the `javascript:install:webpack` command. --- test/webpack_installer_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/webpack_installer_test.rb b/test/webpack_installer_test.rb index cb63458..cd51f9e 100644 --- a/test/webpack_installer_test.rb +++ b/test/webpack_installer_test.rb @@ -5,6 +5,24 @@ class WebpackInstallerTest < ActiveSupport::TestCase include RailsAppHelpers include SharedInstallerTests + test "webpack installer" do + with_new_rails_app do + out, _err = run_installer + + File.read("Procfile.dev").tap do |procfile| + assert_match "js: yarn build --watch", procfile + end + + assert_match "STUBBED gem install foreman", out + + assert File.exist?("webpack.config.js") + + assert_match "STUBBED yarn add webpack", out + assert_match %r{STUBBED npm (?:set-script build |pkg set scripts.build=)webpack --config webpack.config.js}, out + assert_match "STUBBED yarn build", out + end + end + private def run_installer stub_bins("gem", "yarn", "npm")