Skip to content

Incorrect auto-correct for Rails/FreezeTime, when block is passed #764

Closed
@Darhazer

Description

When travel_to is used with a block (e.g. in an around hook), the block is being removed from the auto-corrected code, despite freeze_time also accepting a block

Original code:

around do |example|
  travel_to(Time.current, &example)
end

Expected behavior

Correct to

around do |example|
  freeze_time(&example)
end

Actual behavior

around do |example|
  freeze_time
end

RuboCop version

$ [bundle exec] rubocop -V
1.36.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.1.2) [arm64-darwin21]
  - rubocop-rails 2.16.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions