From cb227e41dc48af9d189a5ecf586c6a50bf2d7c25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 18:59:19 +0000 Subject: [PATCH 1/5] Bump rubocop-rspec from 2.27.0 to 3.0.1 In this version, the RSpec Rails cops have been extracted to a new `rubocop-rspec_rails` gem [1], and the `RSpec/Capybara/FeatureMethods` has been removed in favor of the `RSpec/Dialect` cop. Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.27.0 to 3.0.1. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.27.0...v3.0.1) --- updated-dependencies: - dependency-name: rubocop-rspec dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] [1] https://docs.rubocop.org/rubocop-rspec/upgrade_to_version_3.html [2] https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecdialect --- .rubocop.yml | 39 +++++++++++++++++++++------------------ Gemfile | 3 ++- Gemfile.lock | 12 +++++++----- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 01608ab60..1a05e4577 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,7 @@ require: - rubocop-performance - rubocop-rails - rubocop-rspec + - rubocop-rspec_rails AllCops: DisplayCopNames: true @@ -533,12 +534,6 @@ RSpec/BeNil: Enabled: true EnforcedStyle: be -RSpec/Capybara/FeatureMethods: - Enabled: true - EnabledMethods: - - scenario - - xscenario - RSpec/ContextMethod: Enabled: true @@ -546,6 +541,14 @@ RSpec/DescribedClass: Enabled: true EnforcedStyle: explicit +RSpec/Dialect: + Enabled: true + PreferredMethods: + background: :before + given: :let + given!: :let! + feature: :describe + RSpec/EmptyExampleGroup: Enabled: true Exclude: @@ -595,18 +598,6 @@ RSpec/NotToNot: RSpec/OverwritingSetup: Enabled: true -RSpec/Rails/HaveHttpStatus: - Enabled: true - -RSpec/Rails/InferredSpecType: - Enabled: true - -RSpec/Rails/NegationBeValid: - Enabled: true - -RSpec/Rails/TravelAround: - Enabled: true - RSpec/ReceiveMessages: Enabled: true @@ -634,6 +625,18 @@ RSpec/SpecFilePathSuffix: RSpec/VoidExpect: Enabled: true +RSpecRails/HaveHttpStatus: + Enabled: true + +RSpecRails/InferredSpecType: + Enabled: true + +RSpecRails/NegationBeValid: + Enabled: true + +RSpecRails/TravelAround: + Enabled: true + Security/Eval: Enabled: true diff --git a/Gemfile b/Gemfile index 136f95c74..30e0f482b 100644 --- a/Gemfile +++ b/Gemfile @@ -103,7 +103,8 @@ group :development do gem "rubocop-factory_bot", "~> 2.26.1", require: false gem "rubocop-performance", "~> 1.21.1", require: false gem "rubocop-rails", "~> 2.25.1", require: false - gem "rubocop-rspec", "~> 2.27.0", require: false + gem "rubocop-rspec", "~> 3.0.1", require: false + gem "rubocop-rspec_rails", "~> 2.30.0", require: false gem "rvm1-capistrano3", "~> 1.4.0", require: false gem "spring", "~> 4.2.1" gem "web-console", "~> 4.2.1" diff --git a/Gemfile.lock b/Gemfile.lock index d053f55bb..e6df7bb9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -561,10 +561,11 @@ GEM rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (2.27.0) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) + rubocop-rspec (3.0.3) + rubocop (~> 1.61) + rubocop-rspec_rails (2.30.0) + rubocop (~> 1.61) + rubocop-rspec (~> 3, >= 3.0.1) ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) ruby-vips (2.1.4) @@ -770,7 +771,8 @@ DEPENDENCIES rubocop-factory_bot (~> 2.26.1) rubocop-performance (~> 1.21.1) rubocop-rails (~> 2.25.1) - rubocop-rspec (~> 2.27.0) + rubocop-rspec (~> 3.0.1) + rubocop-rspec_rails (~> 2.30.0) rvm1-capistrano3 (~> 1.4.0) sassc-embedded (~> 1.70.1) sassc-rails (~> 2.1.2) From dea317c6146de8a794097342912a72e022b21e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2024 22:56:51 +0200 Subject: [PATCH 2/5] Add RSpec/EmptyOutput rubocop rule This rule was added in rubocop-rspec 2.29.0. While we never use the `output` matcher, it might actually be a good idea to use it in tests of take tasks, to check the logger output. --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 1a05e4577..388d7aa90 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -565,6 +565,9 @@ RSpec/EmptyLineAfterExampleGroup: Exclude: - spec/factories/**/* +RSpec/EmptyOutput: + Enabled: true + RSpec/ExampleWording: Enabled: true From d90b799342177c33887fcd5ecb13abcd2cf62bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2024 22:58:15 +0200 Subject: [PATCH 3/5] Add RSpec/UndescriptiveLiteralsDescription rule This rule was added in rubocop-rspec 2.29.0. We were already following it. --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 388d7aa90..d206e61a8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -625,6 +625,9 @@ RSpec/SpecFilePathFormat: RSpec/SpecFilePathSuffix: Enabled: true +RSpec/UndescriptiveLiteralsDescription: + Enabled: true + RSpec/VoidExpect: Enabled: true From 04eaa802cc8ead1d3212194eea33767ba83f6b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2024 22:59:45 +0200 Subject: [PATCH 4/5] Add RSpec/ExpectInLet rubocop rule This rule was added in rubocop-rspec 2.30.0. We were already following it. It might be useful to detect typos during development. --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index d206e61a8..b93a3d021 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -574,6 +574,9 @@ RSpec/ExampleWording: RSpec/ExcessiveDocstringSpacing: Enabled: true +RSpec/ExpectInLet: + Enabled: true + RSpec/Focus: Enabled: true From 140ca2feb9f785f28f9154abb77dd58181cb85bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2024 23:02:12 +0200 Subject: [PATCH 5/5] Add RSpec/MissingExpectationTargetMethod rule This rule was introduced in rubocop-rspec 3.0.0. We were already following it. It might be helpful because during development I've made typos prevented by this rule a couple of times. --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index b93a3d021..a183aa5b7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -598,6 +598,9 @@ RSpec/LetSetup: RSpec/MetadataStyle: Enabled: true +RSpec/MissingExpectationTargetMethod: + Enabled: true + RSpec/NotToNot: Enabled: true