-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 custom start date for Faker::Date.forward
#2791
Add custom start date for Faker::Date.forward
#2791
Conversation
f86cb67
to
c841384
Compare
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.
Thanks for working on this, I think this is a good solution that adds flexibility to this generator.
Left a comment about the test, as I don't think it's necessary to run it 100 times.
*Allow set from as String or Date type
c841384
to
28f7eb0
Compare
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, thank you!
100.times do | ||
random_date = @tester.forward(from: from, days: 5) | ||
|
||
assert random_date > from_date, "Expected > \"#{from}\", but got #{random_date}" | ||
end |
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.
100.times do | |
random_date = @tester.forward(from: from, days: 5) | |
assert random_date > from_date, "Expected > \"#{from}\", but got #{random_date}" | |
end | |
random_date = @tester.forward(from: from, days: 5) | |
assert random_date > from_date, "Expected > \"#{from}\", but got #{random_date}" |
Faker::Date.forward
Motivation / Background
The goal of this PR is to make it possible to use a custom start date using the Faker::Date.forward function. Adding this will enable from param to be filled with 'Date.current' from Rails or a String like "Thu, 22 Jun 2023"
Fixes #2093.
Additional information
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
If you're proposing a new generator: