-
-
Notifications
You must be signed in to change notification settings - Fork 765
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
Allow array as value for type
key in Configuration#include
#2890
Comments
context 'with any of', numbers: [0, 20] do To my taste, this would be a bit too magical, and would add more complexity, while we strive to simplify how it works. See
Please accept my apologies if I'm overreacting to a proposal for a trivial change. Can you please briefly explain what changes do you have in mind exactly? Also, it should work fine this way: config.include Capybara::RSpecMatchers, type: ->(type) { [:request, :component].include?(type) }
# or even
def in(*list)
->(value) { list.include(value) }
end
config.include Capybara::RSpecMatchers, type: in(:request, :component) |
I have nothing specific in mind, I just wanted to get this conversation started. If it's easier to add, to me the proc/lambda is fine. |
Can I suggest that this is already catered for by Ruby?
|
@JonRowe That definitely works, I just opened the issue to check if there's any other way to do it or if it is a common pattern so we could handle it at the library level. Is there any other config that would benefit from an array/proc like we discussed above? If not, i guess we can close this one. |
Can't tell of the top of my head. Proc and Thanks! |
Subject of the issue
I want to be able to pass multiple types in the
type
config of the methodRSpec::Core::Configuration#include
. This would allow a cleaner configuration.Your environment
Steps to reproduce
This is the current way of including a config in multiple types:
Expected behavior
Here's what I'd like to being able to do (We could add a key
types
if this change is not approved).Actual behavior
If an array is given, RSpec seems to ignore the option.
I'd be happy to provide a PR for this.
The text was updated successfully, but these errors were encountered: