rubocop-rspec.yml in gitlab-styles-11.0.0 vs rubocop-rspec.yml in gitlab-styles-13.0.0
- old
+ new
@@ -1,14 +1,11 @@
---
require:
+ - rubocop-rspec
+ - rubocop-rspec_rails
- ./lib/gitlab/styles/rubocop
-# Check for create_list FactoryBot declarations higher than MaxAmount
-RSpec/FactoryBot/ExcessiveCreateList:
- Enabled: true
- MaxAmount: 10
-
# Check that instances are not being stubbed globally.
RSpec/AnyInstance:
Enabled: false
# Check for expectations where `be(...)` can replace `eql(...)`.
@@ -40,10 +37,22 @@
# Checks that tests use `described_class`.
RSpec/DescribedClass:
Enabled: true
SkipBlocks: true
+# Enforces custom RSpec dialects.
+# Migrated config from RSpec/Capybara/FeatureMethods
+RSpec/Dialect:
+ Enabled: true
+ PreferredMethods:
+ background: :before
+ scenario: :it
+ xscenario: :xit
+ given: :let
+ given!: :let!
+ feature: :describe
+
# Checks if an example group does not include any tests.
RSpec/EmptyExampleGroup:
Enabled: true
# Checks if there is an empty line after let blocks.
@@ -80,16 +89,10 @@
# Checks for opportunities to use `expect { … }.to output`.
RSpec/ExpectOutput:
Enabled: true
-# Checks the file and folder naming of the spec file.
-# Will be replaced with RSpec/SpecFilePathFormat and RSpec/SpecFilePathSuffix.
-RSpec/FilePath:
- Enabled: true
- IgnoreMethods: true
-
# Checks if there are focused specs.
RSpec/Focus:
Enabled: true
# Checks the arguments passed to `before`, `around`, and `after`.
@@ -105,10 +108,14 @@
# SupportedStyles: is_expected, should
RSpec/ImplicitExpect:
Enabled: true
EnforcedStyle: is_expected
+# Do not set up test data using indexes (e.g., item_1, item_2).
+RSpec/IndexedLet:
+ Enabled: false
+
# Checks for the usage of instance variables.
# https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#subject-and-let-variables
RSpec/InstanceVariable:
Enabled: true
@@ -118,10 +125,15 @@
# Checks unreferenced `let!` calls being used for test setup.
RSpec/LetSetup:
Enabled: false
+# Checks where match_array is used.
+# see: https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/225
+RSpec/MatchArray:
+ Enabled: false
+
# Check that chains of messages are not being stubbed.
RSpec/MessageChain:
Enabled: false
# Checks that message expectations are set using spies.
@@ -162,19 +174,22 @@
Enabled: true
Exclude:
- 'spec/factories/*'
- 'spec/requests/api/v3/*'
+# Sort RSpec metadata alphabetically.
+# see: https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/232#note_2089653748
+RSpec/SortMetadata:
+ Enabled: false
+
# Checks the file and folder naming of the spec file.
-# Will replace RSpec/FilePath.
RSpec/SpecFilePathFormat:
- Enabled: false
+ Enabled: true
IgnoreMethods: true
# Checks the file and folder naming of the spec file.
-# Will replace RSpec/FilePath.
RSpec/SpecFilePathSuffix:
- Enabled: false
+ Enabled: true
# Checks that message expectations do not have a configured response.
# https://docs.rubocop.org/rubocop-rspec/1.44/cops_rspec.html#rspecstubbedmock
RSpec/StubbedMock:
Enabled: false