Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Fix include(/regexp/) when used without a count. #1485

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Sep 5, 2024

Fixes #1481 there was a bug where a regexp and a count contraint would work with the include matcher, but not a bare regexp e.g.

# worked
expect("astring").to include(/a/).once

# failed
expect("astring").to include(/a/)

This makes this consistent with the docs as working, in another version of RSpec we may look to deprecate this usage as it is not doing an include? call but using scan instead.

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thanks!

@JonRowe JonRowe merged commit 981136e into main Sep 6, 2024
30 checks passed
@JonRowe JonRowe deleted the fix-regexp-include-without-count branch September 6, 2024 07:52
JonRowe added a commit that referenced this pull request Sep 6, 2024
JonRowe added a commit that referenced this pull request Sep 6, 2024
Fix `include(/regexp/)` when used without a count.
JonRowe added a commit that referenced this pull request Sep 6, 2024
@JonRowe
Copy link
Member Author

JonRowe commented Sep 7, 2024

Released in 3.13.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Behaviour of include against a String with a Regexp matcher "feels" inconsistent
2 participants