-
-
Notifications
You must be signed in to change notification settings - Fork 282
Description
I've turned off Rails/RedundantTravelBack because it's auto-corrected and on by default, but the after_teardown
hook is only called in Minitest, not in RSpec, from what I can tell. So my travel_backs are getting removed even though I use Rspec and need them. Given that we can initialize Rails without Minitest, does it make sense to make this clearer in documentation and/or not autocorrect this particular cop? It seems like this behavior, even though it's built into part of Rails, is more Minitest-specific.
Since this lives at the intersection of Rails and RSpec, I'm not sure if there's a better rubocop extension to add this to, happy to open a PR at rubocop-rspec
if that makes more sense.
Expected behavior
Not remove my necessary travel_back calls
Actual behavior
Necessary travel_back calls are removed
Steps to reproduce the problem
In a Rails app using RSpec instead of minitest, put an after { travel_back }
hook in a file where travel_to
happens in a before block or in an expectation block. Run rubocop -a
and your travel_back will be removed, and your tests will break
RuboCop version
β be rubocop -V
1.22.1 (using Parser 3.0.2.0, rubocop-ast 1.12.0, running on ruby 3.0.2 x86_64-darwin20)
- rubocop-rails 2.12.4
- rubocop-rspec 2.5.0