diff --git a/CHANGELOG.md b/CHANGELOG.md index 90e18046..2af053ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ Changes since the last non-beta release. ### Fixed +- Fixes failing tests for Ruby 2.7 due to `Rack::Handler::Puma.respond_to?(:config)` [PR 501](https://github.com/shakacode/shakapacker/pull/501) by [adriangohjw](https://github.com/adriangohjw) + - Improve documentation for using Yarn PnP [PR 484](https://github.com/shakacode/shakapacker/pull/484) by [G-Rath](https://github.com/g-rath). - Remove old `yarn` bin script [PR 483](https://github.com/shakacode/shakapacker/pull/483) by [G-Rath](https://github.com/g-rath). diff --git a/spec/generator_specs/generator_spec.rb b/spec/generator_specs/generator_spec.rb index ed4ed0fb..df56b2a8 100644 --- a/spec/generator_specs/generator_spec.rb +++ b/spec/generator_specs/generator_spec.rb @@ -19,10 +19,23 @@ )) Bundler.with_unbundled_env do - sh_in_dir({}, BASE_RAILS_APP_PATH, %( - gem update bundler - bundle add shakapacker --path "#{GEM_ROOT}" - )) + if RUBY_VERSION.start_with?("2.") + # Bundler's version compatible with Ruby 2 does not support "--path" switch + # Overwriting "rack" version due to unless Rack::Handler::Puma.respond_to?(:config) in Capybara gem v3.39.2 or earlier. + # Issue resolved in Capybara v3.40.0, but Ruby 2.7 support dropped; last compatible version is v3.39.2. + # Ref: https://github.com/shakacode/shakapacker/issues/498 + sh_in_dir({}, BASE_RAILS_APP_PATH, %( + gem update bundler + echo 'gem "shakapacker", :path => "#{GEM_ROOT}"' >> Gemfile + echo 'gem "rack", "< 3.0.0"' >> Gemfile + bundle install + )) + else + sh_in_dir({}, BASE_RAILS_APP_PATH, %( + gem update bundler + bundle add shakapacker --path "#{GEM_ROOT}" + )) + end end end