-
Notifications
You must be signed in to change notification settings - Fork 41
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
(PA-5641) Update rspec tests with modern Ruby #317
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mhashizume
force-pushed
the
PA-5641/main/ruby-32
branch
2 times, most recently
from
July 5, 2023 18:20
8492af8
to
71531ff
Compare
This commit updates the rspec GitHub Actions workflow to drop Puppet 6 and Ruby 2.5 and add Puppet 8 and its corresponding Rubies (MRI 3.2 and JRuby 9.4.2.0). Because of Ruby incompatibilities, this commit also updates tests to run against specific pairings of Puppet and Ruby, instead of testing the entire matrix against everything else.
mhashizume
force-pushed
the
PA-5641/main/ruby-32
branch
from
July 5, 2023 21:48
71531ff
to
216ee67
Compare
This commit updates dead links in the README.
Prior to this commit, the `processing` method's final argument, `message`, used a colon, which is the syntax for a keyword argument. This does not seem to be the intended behavior given how the method is called in tests, and may be an artifact from earlier versions of Ruby. This commit updates the `processing` method's final argument from a keyword argument to an optional positional argument by changing the colon to an equals sign.
mhashizume
force-pushed
the
PA-5641/main/ruby-32
branch
from
July 5, 2023 22:54
216ee67
to
23bd7a8
Compare
Prior to this commit, the `try_mungify` method used the `=~` method to match numeric values to munge. The `=~` method was removed for `Object` in Ruby 3.2[1]. This removal causes failure in `try_mungify` as the class of the value parameter is ambiguous and Ruby would attempt to call `=~` on every value. However, `String` still has the `=~` method in Ruby 3.2 and since `Object#=~` always returned nil before its removal, `try_mungify` likely only ever matched on `String` objects to begin with. This commit updates the logic in `try_mungify` to check whether the value is a string, then checks for matches against numeric regex. [1] https://bugs.ruby-lang.org/issues/15231
mhashizume
force-pushed
the
PA-5641/main/ruby-32
branch
4 times, most recently
from
July 6, 2023 20:51
daa0d11
to
26d6c08
Compare
Ruby >= 3.0 is more strict about interpreting keyword arguments than previous Rubies. This commit updates rspec tests to receive an options hashes instead of keyword arguments to enable these tests to run on Ruby >= 3.0. Additionally, this commit disables the Style/BracesAroundHashParameters cop in Rubocop, as it is a style choice that conflicts with the functionality of these options hashes. This cop may also be generating false positives because the version of Rubocop that we're running is over five years old and was released before the separation of positional and keyword arguments that appeared in more recent versions of Ruby[1]. [1] https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
When running rspec on Ruby 3.2, it interprets the `match` method literally when used within a method call with other arguments, breaking the test. This commit updates that expectation to use `start_with` instead and opt to match the string instead of regex.
mhashizume
force-pushed
the
PA-5641/main/ruby-32
branch
from
July 6, 2023 21:23
26d6c08
to
9e595f6
Compare
joshcooper
approved these changes
Jul 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit updates the versions of Ruby and Puppet that rspec tests run on to include Ruby 3.2 and Puppet 8.