-
-
Notifications
You must be signed in to change notification settings - Fork 263
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 new Rails/FreezeTime
cop
#714
Conversation
904a814
to
d81f242
Compare
Can you open it to the Rails Style Guide first? |
d81f242
to
2f68140
Compare
The |
05e8d69
to
339a7f5
Compare
Even if we adopt this pull request, I thought it would be appropriate to merge it into https://github.com/rubocop/rubocop-rspec . |
The testing framework provided by Rails core is |
I see. I made a mistake because it is related to the test, but you're right! |
339a7f5
to
792357e
Compare
0b08ba6
to
f60e663
Compare
Refs: https://github.com/rubocop/rails-style-guide#freeze_time This cop Identifies usages of `travel_to` with argument current time and change them to use `freeze_time` instead. @example ```ruby # bad travel_to(Time.now) travel_to(DateTime.now) travel_to(Time.current) travel_to(Time.zone.now) travel_to(Time.now.in_time_zone) travel_to(Time.current.to_time) # good freeze_time ```
f60e663
to
8bedc3f
Compare
Thanks! |
Refs: https://github.com/rubocop/rails-style-guide#freeze_time
This cop Identifies usages of
travel_to
with argument current time andchange them to use
freeze_time
instead.@example
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.