-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tests uninitialized constant rack #501
Fix tests uninitialized constant rack #501
Conversation
WalkthroughThese changes improve compatibility and ensure test reliability across different Ruby versions, particularly focusing on Ruby 2.7. Updates include adjustments to gem dependencies based on Ruby versions and a fix for failing tests due to an uninitialized constant Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- spec/generator_specs/generator_spec.rb (1 hunks)
Additional comments not posted (2)
spec/generator_specs/generator_spec.rb (2)
34-37
: Ensure compatibility with Ruby versions >= 3.The conditional block for Ruby versions greater than or equal to 3 correctly updates the bundler and adds the
shakapacker
gem.Ensure that the changes are thoroughly tested to confirm they resolve the issue without introducing new problems.
22-33
: Ensure compatibility with Ruby 2.7.The conditional block correctly updates the bundler and specifies the
rack
gem version to avoid the uninitialized constantRack::Handler::Puma.respond_to?(:config)
error in Capybara gem v3.39.2 or earlier. This is a necessary change for compatibility with Ruby 2.7.However, ensure that the changes are thoroughly tested to confirm they resolve the issue without introducing new problems.
Verification successful
The conditional block correctly updates the bundler and specifies the
rack
gem version for compatibility with Ruby 2.7.The verification confirms that the changes are correctly implemented as described. The conditional block includes the necessary commands to update the bundler and specify the
rack
gem version to avoid issues with Capybara gem v3.39.2 or earlier.
- The conditional block for Ruby 2.x versions is correctly implemented.
- The gem version specifications within the block are accurate.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the changes for compatibility with Ruby 2.7. # Test: Run the tests with the modified Gemfile to ensure no errors. bundle install && bundle exec rspecLength of output: 90
Script:
#!/bin/bash # Verify the presence of the conditional block and the correctness of the gem version specifications in the codebase. # Search for the conditional block that checks for Ruby 2.x versions rg 'if RUBY_VERSION\.start_with\?\("2\."\)' -A 10 spec/generator_specs/generator_spec.rb # Verify the gem version specifications within the conditional block rg 'echo \'gem "rack", "< 3.0.0"\' >> Gemfile' -A 5 spec/generator_specs/generator_spec.rbLength of output: 846
Script:
#!/bin/bash # Verify the correctness of the gem version specifications within the conditional block. # Verify the gem version specifications within the conditional block rg 'echo \'gem "rack", "< 3.0.0"\' >> Gemfile' -A 5 spec/generator_specs/generator_spec.rbLength of output: 93
Script:
#!/bin/bash # Verify the correctness of the gem version specifications within the conditional block. # Verify the gem version specifications within the conditional block rg "echo 'gem \"rack\", \"< 3.0.0\"' >> Gemfile" -A 5 spec/generator_specs/generator_spec.rbLength of output: 268
@justin808 all tests passed in my fork (https://github.com/adriangohjw/shakapacker/pull/3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- CHANGELOG.md (1 hunks)
Additional context used
Markdownlint
CHANGELOG.md
15-15: Expected: asterisk; Actual: dash
Unordered list style(MD004, ul-style)
17-17: Expected: asterisk; Actual: dash
Unordered list style(MD004, ul-style)
19-19: Expected: asterisk; Actual: dash
Unordered list style(MD004, ul-style)
* upgrade actions/setup-node to v4 * Fix tests uninitialized constant rack (#501) * fix: manually insert shakapacker using "echo" instead * manually overwrite "rack" to be v2 * update changelog
Summary
Closes #498
Tests for ruby 2.7 were failing due to unless
Rack::Handler::Puma.respond_to?(:config)
in Capybara gem v3.39.2 or earlier.This is caused by
Rack
moving to a separate gemRackup
in Rack 3Issue resolved in Capybara v3.40.0, but Ruby 2.7 support dropped; last compatible version is v3.39.2.
Hardcoding
rack
to be version 2 fixes itPull Request checklist
- [ ] Add/update test to cover these changescapybara
which only happens in test environment, do you think we need to write a test for it? (@justin808)- [ ] Update documentationOther Information
Unsure if this is the best fix, but it's the easiest one I could come up with that does not require huge changes - especially when Ruby 2.7 has already passed EOL 2023-03-31
Summary by CodeRabbit
Rack::Handler::Puma.respond_to?(:config)
.