-
Notifications
You must be signed in to change notification settings - Fork 325
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
Add Ruby 3.1 support #1736
Add Ruby 3.1 support #1736
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1736 +/- ##
==========================================
+ Coverage 74.77% 74.78% +0.01%
==========================================
Files 82 82
Lines 4853 4859 +6
==========================================
+ Hits 3629 3634 +5
- Misses 1224 1225 +1
Continue to review full report at Codecov.
|
Ruby 2.7 changed behavior around passing in an options hash at the end. This is a more explicit specification of what happens.
In Ruby 3.1 using trim_mode must be passed as a keyword argument or a deprecation warning is shown. However, that is only possible on Ruby 2.7 or newer.
@@ -28,3 +28,5 @@ group :coverage, optional: ENV['COVERAGE']!='yes' do | |||
gem 'simplecov-console', :require => false | |||
gem 'codecov', :require => false | |||
end | |||
|
|||
gem 'rdoc' if RUBY_VERSION >= '3.1' |
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.
#1737 will make this obsolete, but I first want to release a minor version that adds Ruby 3.1 support, then do a major one.
spec/beaker/cli_spec.rb
Outdated
@@ -1,5 +1,15 @@ | |||
require 'spec_helper' | |||
|
|||
def load_yaml_file(path) | |||
permitted = [Beaker::Options::OptionsHash, Symbol, RSpec::Mocks::Double, Time] |
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.
The double is because the logger is being serialized for some reason. Looks like a bug to me, but I consider that out of scope.
Psych 4 is being a pain and I don't have Ruby 2.7 installed right now. Hence the multiple pushes. |
Ruby 3.1 contains Psych 4 which defaults to safe loading. A small helper is introduced to avoid repetition.
This now passes CI |
else | ||
ERB.new(template, nil, '-') | ||
end | ||
if RUBY_VERSION >= '2.6' |
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.
Ruby 2.4 and 2.5 (or rather, their Psych version) do not accept permitted_classes as an argument to safe_load
In Ruby 3.1 using trim_mode must be passed as a keyword argument or a deprecation warning is shown. However, that is only possible on Ruby 2.7 or newer.