-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 flaky spec on TestFakerFile#test_file_name
#2867
Comments
I'd like to give this a shot 🤚 |
sounds good, thank you @keshavbiswa ! |
This seems like an issue with It for some reason matches everystring but "whole-bless/cupiditate.mp3". matcher = %r{^([a-z\-_.]+)(\\|/)([a-z\-_]+)\.([a-z]+)$}
matcher = Regexp.new Regexp.escape matcher if String === matcher
obj= "cutting-minister/qui.numbers"
matcher =~ obj
Regexp.last_match # => #<MatchData "cutting-minister/qui.numbers" 1:"cutting-minister" 2:"/" 3:"qui" 4:"numbers">
obj = "appointment-notebook/occaecati.bmp"
matcher =~ obj
Regexp.last_match # => #<MatchData "appointment-notebook/occaecati.bmp" 1:"appointment-notebook" 2:"/" 3:"occaecati" 4:"bmp">
# For some reason this doesn't work
obj = "whole-bless/cupiditate.mp3"
matcher =~ obj
Regexp.last_match # => Returns nil I'm not a Regex expert, could someone help me understand what is the problem here? |
I think I got it, it's not matching the number (.mp3) as the extension. So updating the last part in the regex to assert for alphanumeric should do the job. |
yep, you got it! Thanks! |
Describe the bug
There is a flaky spec on
faker/test/faker/default/test_faker_file.rb
Line 24 in 391da60
Failed run
Maybe caused by the latest Rubocop version bump?
#2864
The text was updated successfully, but these errors were encountered: