Skip to content

Commit

Permalink
Add Ruby 3.2 to the CI matrix (#571)
Browse files Browse the repository at this point in the history
* Adds Ruby 3.2 to the CI matrix

* Use object_id rather than trust, as trust is no longer a method on Object in Ruby 3.2.  Condition checked on Psych error based on version of Psych.

* Update danger token

* Add CHANGELOG entry

* Add use of Gem::Version for version comparison
  • Loading branch information
petergoldstein committed Jan 13, 2023
1 parent 6fabbfd commit 2b3120a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/danger.yml
Expand Up @@ -17,5 +17,5 @@ jobs:
run: |
bundle install
# the personal token is public, this is ok, base64 encode to avoid tripping Github
TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Expand Up @@ -25,6 +25,7 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.2'
- '3.1'
- '3.0'
- '2.7'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,7 @@ Any violations of this scheme are considered to be bugs.

### Changed

* [#571](https://github.com/hashie/hashie/pull/571): Test with Ruby 3.2 - [@petergoldstein](https://github.com/petergoldstein).
* [#558](https://github.com/hashie/hashie/pull/558): Test with Ruby 3.1 - [@petergoldstein](https://github.com/petergoldstein).
* Your contribution here.

Expand Down
17 changes: 12 additions & 5 deletions spec/hashie/mash_spec.rb
Expand Up @@ -137,9 +137,9 @@

include_context 'with a logger' do
it 'logs a warning when overriding built-in methods' do
Hashie::Mash.new('trust' => { 'two' => 2 })
Hashie::Mash.new('object_id' => { 'two' => 2 })

expect(logger_output).to match('Hashie::Mash#trust')
expect(logger_output).to match('Hashie::Mash#object_id')
end

it 'can set keys more than once and does not warn when doing so' do
Expand Down Expand Up @@ -821,9 +821,16 @@ class SubMash < Hashie::Mash
expect(mash.company_a.accounts.admin.password).to eq('secret')
end
it 'can override the value of aliases' do
expect do
Hashie::Mash.load('spec/fixtures/yaml_with_aliases.yml', aliases: false)
end.to raise_error Psych::BadAlias, /base_accounts/
require 'psych'
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('5')
expect do
Hashie::Mash.load('spec/fixtures/yaml_with_aliases.yml', aliases: false)
end.to raise_error Psych::AliasesNotEnabled, /Alias parsing was not enabled/
else
expect do
Hashie::Mash.load('spec/fixtures/yaml_with_aliases.yml', aliases: false)
end.to raise_error Psych::BadAlias, /base_accounts/
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/hashie/utils_spec.rb
Expand Up @@ -7,7 +7,7 @@ def a_method_to_match_against
RSpec.describe Hashie::Utils do
describe '.method_information' do
it 'states the module or class that a native method was defined in' do
bound_method = method(:trust)
bound_method = method(:object_id)

message = Hashie::Utils.method_information(bound_method)

Expand Down

0 comments on commit 2b3120a

Please sign in to comment.