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
Fixes when given an array as rspec_opt
#2704
Conversation
…succeeding. We really should have `include(...).once` as an available matcher. rspec/rspec-expectations#685
Found because `array =~ /.../` is deprecated in 2.7 and generates a warning in Ruby 2.6.
@@ -122,7 +122,7 @@ def file_inclusion_specification | |||
if ENV['SPEC'] | |||
FileList[ENV['SPEC']].sort | |||
elsif String === pattern && !File.exist?(pattern) | |||
return if rspec_opts =~ /--pattern/ | |||
return if [*rspec_opts].any? { |opt| opt =~ /--pattern/ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering where rspec_opts
is coming from. I could only find it being assigned a nil
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a writable attribute, so it can be set directly on the task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example using an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Thanks! |
Fixes when given an array as `rspec_opt`
Fixes when given an array as `rspec_opt`
…opt_array Fixes when given an array as `rspec_opt` --- This commit was imported from rspec/rspec-core@664283f.
This commit was imported from rspec/rspec-core@33f15a0.
Rspec raketask's
rspec_opt
accepts a string or an array of strings.In Ruby 2.7 a deprecation warning is generated for arrays. This led me to find and error that was undetected because there is no spec for the array case. Moreover I realized that the existing spec for string was erroneously written. This PR fixes both issues