Skip to content

Commit

Permalink
Merge pull request rubocop#1662 from rubocop/change_path
Browse files Browse the repository at this point in the history
Change default.yml path to use `**/spec/*` instead of `spec/*`
  • Loading branch information
ydah authored Jul 20, 2023
2 parents 9632317 + 0dc19dd commit b03a388
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Update the message output of `RSpec/ExpectActual` to include the word 'value'. ([@corydiamand])
- Fix a false negative for `RSpec/Pending` when `it` without body. ([@ydah])
- Add new `RSpec/ReceiveMessages` cop. ([@ydah])
- Change default.yml path to use `**/spec/*` instead of `spec/*`. ([@ydah])
- Add `AllowedIdentifiers` and `AllowedPatterns` configuration option to `RSpec/IndexedLet`. ([@ydah])
- Fix `RSpec/NamedSubject` when block has no body. ([@splattael])
- Fix `RSpec/LetBeforeExamples` autocorrect incompatible with `RSpec/ScatteredLet` autocorrect. ([@ydah])
Expand Down
34 changes: 18 additions & 16 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ RSpec/BeforeAfterAll:
Description: Check that before/after(:all) isn't being used.
Enabled: true
Exclude:
- spec/spec_helper.rb
- spec/rails_helper.rb
- spec/support/**/*.rb
- "**/spec/spec_helper.rb"
- "**/spec/rails_helper.rb"
- "**/spec/support/**/*.rb"
VersionAdded: '1.12'
VersionChanged: "<<next>>"
StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll

Expand Down Expand Up @@ -404,8 +405,9 @@ RSpec/ExpectActual:
Description: Checks for `expect(...)` calls containing literal values.
Enabled: true
Exclude:
- spec/routing/**/*
- "**/spec/routing/**/*"
VersionAdded: '1.7'
VersionChanged: "<<next>>"
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual

RSpec/ExpectChange:
Expand Down Expand Up @@ -983,11 +985,11 @@ RSpec/FactoryBot/AttributeDefinedStatically:
Description: Always declare attribute values as blocks.
Enabled: true
Include:
- spec/factories.rb
- spec/factories/**/*.rb
- features/support/factories/**/*.rb
- "**/spec/factories.rb"
- "**/spec/factories/**/*.rb"
- "**/features/support/factories/**/*.rb"
VersionAdded: '1.28'
VersionChanged: '2.0'
VersionChanged: "<<next>>"
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically

RSpec/FactoryBot/ConsistentParenthesesStyle:
Expand All @@ -1006,26 +1008,26 @@ RSpec/FactoryBot/CreateList:
Include:
- "**/*_spec.rb"
- "**/spec/**/*"
- spec/factories.rb
- spec/factories/**/*.rb
- features/support/factories/**/*.rb
- "**/spec/factories.rb"
- "**/spec/factories/**/*.rb"
- "**/features/support/factories/**/*.rb"
EnforcedStyle: create_list
SupportedStyles:
- create_list
- n_times
VersionAdded: '1.25'
VersionChanged: '2.0'
VersionChanged: "<<next>>"
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList

RSpec/FactoryBot/FactoryClassName:
Description: Use string value when setting the class attribute explicitly.
Enabled: true
Include:
- spec/factories.rb
- spec/factories/**/*.rb
- features/support/factories/**/*.rb
- "**/spec/factories.rb"
- "**/spec/factories/**/*.rb"
- "**/features/support/factories/**/*.rb"
VersionAdded: '1.37'
VersionChanged: '2.0'
VersionChanged: "<<next>>"
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName

RSpec/FactoryBot/FactoryNameStyle:
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/ROOT/pages/cops_rspec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ expect(foo).to be(nil)
| Yes
| No
| 1.12
| -
| <<next>>
|===

Check that before/after(:all) isn't being used.
Expand Down Expand Up @@ -412,7 +412,7 @@ end
| Name | Default value | Configurable values

| Exclude
| `spec/spec_helper.rb`, `spec/rails_helper.rb`, `+spec/support/**/*.rb+`
| `+**/spec/spec_helper.rb+`, `+**/spec/rails_helper.rb+`, `+**/spec/support/**/*.rb+`
| Array
|===

Expand Down Expand Up @@ -1767,7 +1767,7 @@ end
| Yes
| Yes
| 1.7
| -
| <<next>>
|===

Checks for `expect(...)` calls containing literal values.
Expand Down Expand Up @@ -1798,7 +1798,7 @@ expect(false).to eq(true)
| Name | Default value | Configurable values

| Exclude
| `+spec/routing/**/*+`
| `+**/spec/routing/**/*+`
| Array
|===

Expand Down
12 changes: 6 additions & 6 deletions docs/modules/ROOT/pages/cops_rspec_factorybot.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| Yes
| Yes
| 1.28
| 2.0
| <<next>>
|===

Always declare attribute values as blocks.
Expand Down Expand Up @@ -43,7 +43,7 @@ count { 1 }
| Name | Default value | Configurable values

| Include
| `spec/factories.rb`, `+spec/factories/**/*.rb+`, `+features/support/factories/**/*.rb+`
| `+**/spec/factories.rb+`, `+**/spec/factories/**/*.rb+`, `+**/features/support/factories/**/*.rb+`
| Array
|===

Expand Down Expand Up @@ -131,7 +131,7 @@ build(
| Yes
| Yes
| 1.25
| 2.0
| <<next>>
|===

Checks for create_list usage.
Expand Down Expand Up @@ -177,7 +177,7 @@ create_list :user, 3
| Name | Default value | Configurable values

| Include
| `+**/*_spec.rb+`, `+**/spec/**/*+`, `spec/factories.rb`, `+spec/factories/**/*.rb+`, `+features/support/factories/**/*.rb+`
| `+**/*_spec.rb+`, `+**/spec/**/*+`, `+**/spec/factories.rb+`, `+**/spec/factories/**/*.rb+`, `+**/features/support/factories/**/*.rb+`
| Array

| EnforcedStyle
Expand All @@ -198,7 +198,7 @@ create_list :user, 3
| Yes
| Yes
| 1.37
| 2.0
| <<next>>
|===

Use string value when setting the class attribute explicitly.
Expand Down Expand Up @@ -227,7 +227,7 @@ end
| Name | Default value | Configurable values

| Include
| `spec/factories.rb`, `+spec/factories/**/*.rb+`, `+features/support/factories/**/*.rb+`
| `+**/spec/factories.rb+`, `+**/spec/factories/**/*.rb+`, `+**/features/support/factories/**/*.rb+`
| Array
|===

Expand Down

0 comments on commit b03a388

Please sign in to comment.