-
Notifications
You must be signed in to change notification settings - Fork 557
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
Adds FFaker::Date.birthday #542
Conversation
please add :birthday to assert_methods_are_deterministic |
Co-authored-by: marocchino <marocchino@users.noreply.github.com>
Co-authored-by: marocchino <marocchino@users.noreply.github.com>
Are you ok with me adding TimeCop? |
dcf67be
to
4213cf6
Compare
@marocchino thanks for all your help with this PR. I appreciate it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Well, Personally, I don't like it. Rails treats it as a legacy that needs to be removed, so I often do the work of removing it. |
OK, I believe this PR is ready for merging. |
What for? For tests? I'm OK if it'd help.
Why?
TimeCop doesn't belong to Rails, what the deal with Rails? It's like "FFaker treats RSpec as a legacy". TimeCop is under active development, as I see, and not even v1 for now: |
@marocchino anything blocking the merging of this PR? |
I was expecting another maintainer's approval, but it's okay as is. |
This adds
FFaker::Date.birthday
For our use case, we're looking for realistic looking birthdays for employees at a company. It would be weird in our demo/staging environment to have a 3 year old working at a company, not a good look.
In the case of birthday(min_age: 18, max_age: 18), I would interpret this to mean "I want a date for someone who is 18 years old today" -- this means anyone who just turned 18 today back until last year plus a day. So on 9/6/2023 the range would be 9/7/2004 to 9/6/2005 which would be from:9/6/2023 - 19.years + 1.day to: 9/6/2023 - 18.years
I ran this test 10_000 times to verify correctness:
Fixes #540