From fdb58d0d73307cf745b89a0b30a93b5c8526b4f2 Mon Sep 17 00:00:00 2001 From: r7kamura Date: Sat, 3 Dec 2022 07:35:41 +0900 Subject: [PATCH] Mark `RSpec/Rails/TravelAround` as `Safe: false` --- config/default.yml | 2 +- docs/modules/ROOT/pages/cops_rspec_rails.adoc | 10 +++++++--- lib/rubocop/cop/rspec/rails/travel_around.rb | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config/default.yml b/config/default.yml index 6ab4bfa1d..38a2df88a 100644 --- a/config/default.yml +++ b/config/default.yml @@ -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: "<>" Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/TravelAround diff --git a/docs/modules/ROOT/pages/cops_rspec_rails.adoc b/docs/modules/ROOT/pages/cops_rspec_rails.adoc index e9c92d51e..28c81bcb3 100644 --- a/docs/modules/ROOT/pages/cops_rspec_rails.adoc +++ b/docs/modules/ROOT/pages/cops_rspec_rails.adoc @@ -211,7 +211,7 @@ end | Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed | Pending -| Yes +| No | Yes (Unsafe) | <> | - @@ -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 diff --git a/lib/rubocop/cop/rspec/rails/travel_around.rb b/lib/rubocop/cop/rspec/rails/travel_around.rb index 99d7babc9..5d09d37c1 100644 --- a/lib/rubocop/cop/rspec/rails/travel_around.rb +++ b/lib/rubocop/cop/rspec/rails/travel_around.rb @@ -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