Skip to content

Flaky specs #2772

@thdaraujo

Description

@thdaraujo

Describe the bug

We have some flaky specs at the moment, and it would be nice if we could get them fixed. 🙏

assert_match(/^\d{9}$/, sample)

assert_match(/(\w+\.? ?){3,4}/, @tester.first_name)

To Reproduce

Run CI, or look at this previous failed run:
https://github.com/faker-ruby/faker/actions/runs/5124077333/jobs/9223275835#step:6:45

Expected behavior

No flaky tests!

Additional context

Here's an example:

===============================================================================
Failure: test_brazilian_id(TestFakerIdNumber):
  </^\d{9}$/> was expected to be =~
  <"43[6](https://github.com/faker-ruby/faker/actions/runs/5124077333/jobs/9225159454?pr=2761#step:6:7)[7](https://github.com/faker-ruby/faker/actions/runs/5124077333/jobs/9225159454?pr=2761#step:6:8)[8](https://github.com/faker-ruby/faker/actions/runs/5124077333/jobs/9225159454?pr=2761#step:6:9)337X">.
/home/runner/work/faker/faker/test/faker/default/test_faker_id_number.rb:89:in `test_brazilian_id'
     86:   def test_brazilian_id
     87:     sample = @tester.brazilian_id
     88: 
  => 8[9](https://github.com/faker-ruby/faker/actions/runs/5124077333/jobs/9225159454?pr=2761#step:6:10):     assert_match(/^\d{9}$/, sample)
     90:     assert_match(/(\d)((?!\1)\d)+/, sample)
     91:   end
     92: 
/opt/hostedtoolcache/Ruby/2.7.8/x64/lib/ruby/2.7.0/rubygems/deprecate.rb:63: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/runner/work/faker/faker/lib/faker/default/internet.rb:63: warning: The called method `_deprecated_free_email' is defined here
/opt/hostedtoolcache/Ruby/2.7.8/x64/lib/ruby/2.7.0/rubygems/deprecate.rb:63: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/runner/work/faker/faker/lib/faker/default/internet.rb:81: warning: The called method `_deprecated_safe_email' is defined here

And:

===============================================================================
Failure: test_first_name(TestFakerName):
  </(\w+\.? ?){3,4}/> was expected to be =~
  <"Ta">.
/home/runner/work/faker/faker/test/faker/default/test_faker_name.rb:19:in `test_first_name'
     16:   end
     17: 
     18:   def test_first_name
  => 19:     assert_match(/(\w+\.? ?){3,4}/, @tester.first_name)
     20:   end
     21: 
     [22](https://github.com/faker-ruby/faker/actions/runs/5124077333/jobs/9225334328?pr=2761#step:6:23):   def test_male_first_name
==================================================

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions