-
Notifications
You must be signed in to change notification settings - Fork 242
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
Fix spec path verification with multiple pattern #363
Conversation
This definitely needs a test. Can you copy and adapt the test case from here: rspec/rspec-core@c0632ab#diff-93b32d4222d74bcb2ea7325a91ae6dc5R470 ? I wrote the spec for the https://github.com/guard/guard-rspec/blob/master/spec/lib/guard/rspec_formatter_spec.rb#L235 |
I agree. I have a question to implement the test. Should I change the mock of Thank you for the review! |
Just copy the whole I don't really understand the problem, though. The code: stripped = "{#{pattern.gsub(/\s*,\s*/, ',')}}" Looks like it just removes spaces between |
f5492bf
to
8b8bfc1
Compare
end | ||
|
||
it "matches a spec file with the first pattern" do | ||
expect(described_class.spec_path?('./spec/foo_spec.rb')).to be_truthy |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
RSpec.configuration.pattern may not satisfy a glob pattern if multiple pattern is set (e.g. '**{,/*/**}/*_spec.rb,**/*.feature'). See also RSpec::Core::Configuration#file_glob_from.
8b8bfc1
to
db2f2bb
Compare
I've added the test.
It also wraps the pattern with parentheses The naked pattern |
Arigatou! :) |
Released as guard-rspec 4.6.5. |
The value from
RSpec.configuration.pattern
may not satisfy a glob patternif multiple pattern is set (e.g.
'**{,/*/**}/*_spec.rb,**/*.feature'
).And the formatter prints
no spec file location
warnings on STDOUT for each failed examplesbecause
spec_path?
method can't find the spec file location with a non-glob pattern.This PR fixes
spec_path?
method to be able to find spec files even if a multiple pattern set.The implementation is written referencing RSpec::Core::Configuration.
rspec-core/configuration.rb at master · rspec/rspec-core · GitHub