Skip to content

Commit

Permalink
Fix tests uninitialized constant rack (#501)
Browse files Browse the repository at this point in the history
* fix: manually insert shakapacker using "echo" instead
* manually overwrite "rack" to be v2
  • Loading branch information
adriangohjw authored Jul 6, 2024
1 parent f53f060 commit 04c71d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
21 changes: 17 additions & 4 deletions spec/generator_specs/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 04c71d4

Please sign in to comment.