Skip to content

Commit

Permalink
Add note about Random behavior on MiniTest (#2579)
Browse files Browse the repository at this point in the history
Ruby 3 deprecated `Random::DEFAULT`. Faker 2.22 started
calling `Random` directly. For MiniTest users,
to prevent duplicated values when generating
random values in different test files,
add `Faker::Config.random = Random.new`
to `test_helper` or `rails_helper`.
  • Loading branch information
Stefanni Brasil authored Oct 5, 2022
1 parent 0581eff commit aa5bad2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ development.
* While Faker generates data at random, returned values are not guaranteed to be unique by default.
You must explicitly specify when you require unique values, see [details](#ensuring-unique-values).
Values also can be deterministic if you use the deterministic feature, see [details](#deterministic-random)
* Minitest and Faker >= 2.22 users might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
`Faker::Config.random = Random.new`. See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
* This is the `master` branch of Faker and may contain changes that are not yet released.
Please refer the README of your version for the available methods.
List of all versions is [available here](https://github.com/stympy/faker/releases).
Expand Down

0 comments on commit aa5bad2

Please sign in to comment.