Skip to content

Commit

Permalink
Merge pull request #1362 from mbj/fix/3.1.3
Browse files Browse the repository at this point in the history
Fix specs on ruby 3.1.3
  • Loading branch information
mbj authored Jan 6, 2023
2 parents 77d49d6 + 6778c40 commit 4ff4a00
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1]
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1.3]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1]
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1.3]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -54,7 +54,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1]
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1.3]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -74,7 +74,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1]
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1.3]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -90,7 +90,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1]
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1.3]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -106,7 +106,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1]
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1.3]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -122,7 +122,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1]
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1.3]
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v0.11.18 unreleased

* [#1362](http://github.com/mbj/mutant/pull/1362)

Adapt to behavior change in ruby 3.1.3 where methods inherited
from module inclusions that just got visibility changes are now
owned by the included module/class.

# v0.11.17 2022-11-12

* [#1352](https://github.com/mbj/mutant/pull/1352)
Expand Down
18 changes: 15 additions & 3 deletions spec/unit/mutant/matcher/methods/instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,26 @@ def method_c; end
let(:subject_a) { instance_double(Mutant::Subject) }
let(:subject_b) { instance_double(Mutant::Subject) }
let(:subject_c) { instance_double(Mutant::Subject) }
let(:subjects) { [subject_a, subject_b, subject_c] }
let(:subject_d) { instance_double(Mutant::Subject) }

let(:subjects) do
[subject_a, subject_b, subject_c].tap do |value|
value << subject_d if RUBY_VERSION >= '3.1.3'
end
end

before do
{
expected_subjects = {
method_a: subject_a,
method_b: subject_b,
method_c: subject_c
}.each do |method, subject|
}

if RUBY_VERSION >= '3.1.3'
expected_subjects[:method_d] = subject_d
end

expected_subjects.each do |method, subject|
matcher = instance_double(Mutant::Matcher)
expect(matcher).to receive(:call).with(env).and_return([subject])

Expand Down

0 comments on commit 4ff4a00

Please sign in to comment.