Skip to content
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 specs on ruby 3.1.3 #1362

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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