Skip to content
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

Random::DEFAULT is deprecated on Ruby 3 #2225

Closed
connorshea opened this issue Dec 26, 2020 · 1 comment · Fixed by #2226
Closed

Random::DEFAULT is deprecated on Ruby 3 #2225

connorshea opened this issue Dec 26, 2020 · 1 comment · Fixed by #2226

Comments

@connorshea
Copy link
Member

Describe the bug

Faker causes deprecation warnings on Ruby 3.

To Reproduce

Run code using Faker on Ruby 3 with deprecation warnings enabled (RUBYOPT='-W:deprecated') and see that you get a warning about Random::DEFAULT being deprecated:

/Users/connorshea/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/faker-2.15.1/lib/faker.rb:32: warning: constant Random::DEFAULT is deprecated

Can probably reproduce this with the gem's own test suite, I assume.

Expected behavior

No deprecation warning should be printed because we shouldn't use anything that's deprecated.

See the "Random" section of the NEWS.md file for 3.0.0 for more context and how to fix this warning: https://github.com/ruby/ruby/blob/v3_0_0/NEWS.md

Additional context

Ruby version: 3.0.0
Faker version: 2.15.1

@connorshea connorshea changed the title Issue title goes here Random::DEFAULT is deprecated on Ruby 3 Dec 26, 2020
@connorshea
Copy link
Member Author

This is the code:

@random || Random::DEFAULT

I think we can just replace Random::DEFAULT with Random.new and it'll work fine?

connorshea added a commit to connorshea/faker that referenced this issue Dec 26, 2020
Random::DEFAULT is deprecated in Ruby 3.0.

Fixes faker-ruby#2225.
@koic koic closed this as completed in #2226 Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant