Skip to content

Commit

Permalink
Mark RSpec/Rails/TravelAround as Safe: false
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura committed Dec 2, 2022
1 parent a8dadcd commit fdb58d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,6 @@ RSpec/Rails/HttpStatus:
RSpec/Rails/TravelAround:
Description: Prefer to travel in `before` rather than `around`.
Enabled: pending
SafeAutoCorrect: false
Safe: false
VersionAdded: "<<next>>"
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/TravelAround
10 changes: 7 additions & 3 deletions docs/modules/ROOT/pages/cops_rspec_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ end
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Yes
| No
| Yes (Unsafe)
| <<next>>
| -
Expand All @@ -221,8 +221,12 @@ Prefer to travel in `before` rather than `around`.

=== Safety

This cop's autocorrection is unsafe because the order of execution
will change if other steps exist before traveling in `around`.
This cop is unsafe because the automatic `travel_back` is only run
on test cases that are considered as Rails related.

And also, this cop's autocorrection is unsafe because the order of
execution will change if other steps exist before traveling in
`around`.

=== Examples

Expand Down
8 changes: 6 additions & 2 deletions lib/rubocop/cop/rspec/rails/travel_around.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ module Rails
# Prefer to travel in `before` rather than `around`.
#
# @safety
# This cop's autocorrection is unsafe because the order of execution
# will change if other steps exist before traveling in `around`.
# This cop is unsafe because the automatic `travel_back` is only run
# on test cases that are considered as Rails related.
#
# And also, this cop's autocorrection is unsafe because the order of
# execution will change if other steps exist before traveling in
# `around`.
#
# @example
# # bad
Expand Down

0 comments on commit fdb58d0

Please sign in to comment.