-
-
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
Rails/FreezeTime gives invalid suggestion when travel_to is passed future or past dates #769
Labels
bug
Something isn't working
Comments
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Sep 12, 2022
Fixes rubocop#769. This PR fixes a false positive for `Rails/FreezeTime` when using `travel_to` with an argument of `DateTime.new` with arguments.
9 tasks
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Sep 12, 2022
Fixes rubocop#769. This PR fixes a false positive for `Rails/FreezeTime` when using `travel_to` with an argument of `DateTime.new` with arguments.
koic
added a commit
that referenced
this issue
Sep 13, 2022
…ze_time [Fix #769] Fix a false positive for `Rails/FreezeTime`
This started happening again in 2.17.1 and is still there in 2.17.2 — Shall I open a new issue?
|
@christos Yeah, Can you open a new issue? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rails/FreezeTime incorrectly suggests changes when
travel_to
is used with an argument in the past or the future.It appears that this cop is assuming that the current date/time is always the first argument, but
freeze_time
cannot be used in place oftravel_to
whentravel_to
is being used for a future or past date.Expected behavior
When
travel_to
is used with a past or future date, no suggestion should be made.Actual behavior
When
travel_to
is used with a past or future date, the following incorrect suggestion is made:The autocorrect also incorrectly corrects this to something that is not equivalent:
Steps to reproduce the problem
travel_to
taking a date/time argument that is not equivalent to the current time:rubocop --only Rails/FreezeTime
RuboCop version
The text was updated successfully, but these errors were encountered: