Skip to content

Fix range based change matcher#2275

Merged
avinhurry merged 1 commit intomainfrom
fix-rspec-range-change-matcher
Feb 18, 2026
Merged

Fix range based change matcher#2275
avinhurry merged 1 commit intomainfrom
fix-rspec-range-change-matcher

Conversation

@avinhurry
Copy link
Contributor

Summary

RSpec now compares ranges with == (equality) instead of === (inclusion). So by(30..35) won't match a number like 31 any more.

Switch to be_between to preserve the original inclusive range intent.

See: rspec/rspec@a8f86b7

Fixes the failing test in #2272

RSpec now compares ranges with `==` (equality) instead of `===` (inclusion).
So `by(30..35)` won't match a number like 31 any more.

Switch to `be_between` to preserve the original inclusive range intent.

See: rspec/rspec@a8f86b7
@avinhurry avinhurry force-pushed the fix-rspec-range-change-matcher branch from d438a82 to 2dbf372 Compare February 17, 2026 22:10
@sonarqubecloud
Copy link

@github-actions
Copy link

Review app deployed to https://cpd-ec2-review-2275-web.test.teacherservices.cloud

@avinhurry avinhurry marked this pull request as ready for review February 17, 2026 22:30
Copy link
Member

@peteryates peteryates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@avinhurry avinhurry added this pull request to the merge queue Feb 18, 2026
maximum_records = minimum_records + described_class::SHARED_DELIVERY_PARTNERS_PER_LEAD_PROVIDER
expect { instance.plant }.to(change(LeadProviderDeliveryPartnership, :count).by(minimum_records..maximum_records))
expect { instance.plant }.to(change(LeadProviderDeliveryPartnership, :count).by(be_between(minimum_records, maximum_records)))
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can also have .by(a_value_between(etc.) which is slightly more readable

Merged via the queue into main with commit d4bbdfc Feb 18, 2026
28 checks passed
@avinhurry avinhurry deleted the fix-rspec-range-change-matcher branch February 18, 2026 09:52
@github-actions
Copy link

Review app for PR 2275 was deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants