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

Add id method to Faker::Internet module #2955

Open
hubertjakubiak opened this issue May 17, 2024 · 2 comments
Open

Add id method to Faker::Internet module #2955

hubertjakubiak opened this issue May 17, 2024 · 2 comments

Comments

@hubertjakubiak
Copy link

Hello,

I noticed that the Faker::Internet module does not currently have an id method. This would be a useful addition for generating random, unique numeric identifiers in tests.

Here's an example of how it might be used:

let(:user_id) { Faker::Internet.id }

This would generate a unique integer identifier each time it's called, which would be particularly useful for simulating database IDs in tests.

Thank you for considering this feature request.

@keshavbiswa
Copy link
Contributor

I think we already have Faker::Number.number that can be of use in this case. Also since we have a Faker::IDNumber generator, having another .id will make it confusing.

let(:user_id) { Faker::Number.number(digits: 10) }

Hope this helps. 🙂

@hubertjakubiak
Copy link
Author

Hey @keshavbiswa,

Thanks for the input! I see where you're coming from with the availability of Faker::Number.number(digits: 10). It's definitely a handy feature for generating numeric identifiers.

However, having a dedicated Faker::Internet.id method could provide a more intuitive and semantic way of generating unique identifiers specifically for internet-related scenarios, like simulating user IDs or session tokens. It would align better with the context of internet-related data generation.

Additionally, while Faker::IDNumber is available, it might not be immediately obvious to users that it can be used for generating internet-related IDs. By having a separate .id method within the Faker::Internet module, we could provide clarity and ease of use for those specifically seeking internet-related identifiers.

So, while Faker::Number.number(digits: 10) is useful, having a dedicated Faker::Internet.id method could enhance the readability and usability of the Faker gem for scenarios where internet-related identifiers are needed.

Thanks for considering this perspective!

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

No branches or pull requests

2 participants