-
-
Notifications
You must be signed in to change notification settings - Fork 395
Behaviour of include
against a String with a Regexp matcher "feels" inconsistent
#1481
Comments
I haven't had a chance to dig in to the internals so it may be expected that this is the behaviour, but it's very counter-intuitive in how it works. If this is intended, it would probably make sense to update the docs to clarify this. Even better would be improving the message; something such as `"expect().to include()" requires a 'times' specifier' would go a long way in clarifying the problem. |
include
against a String with a Regexp matcher can be inconsistentinclude
against a String with a Regexp matcher "feels" inconsistent
Indeed this is confusing and unintuitive.
I suggest:
Alternatively, we could fix the matcher to respect regexps. But the matcher’s implementation already feels overloaded. @JonRowe what is your take on this? |
As of RSpec 3.13, it appears that Otherwise I agree with the assessment. It could be argued that |
I think this is a bug, the docs certainly imply an expectation that it would work without a count (all our other matchers would behave this way), so I've fixed it. |
Subject of the issue
With an rspec matcher such as:
there are some unclear behaviours/messages
Your environment
Steps to reproduce
Expected behavior
All specs should pass
Actual behavior
The text was updated successfully, but these errors were encountered: