Skip to content

Commit

Permalink
Fix an error when using RSpec/FilePath.
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Sep 20, 2023
1 parent b99bf78 commit 195a87f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ RSpec/ExampleLength:
- heredoc
Max: 11

RSpec/FilePath:
Enabled: false

RSpec/DescribeClass:
Exclude:
- spec/project/**/*.rb
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## Master (Unreleased)

- Fix an error when using `RSpec/FilePath` and revert to enabled by default. If you have already moved to `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat`, disable `RSpec/FilePath` explicitly as `Enabled: false`. The `RSpec/FilePath` before migration and the `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat` at the target are available respectively. ([@ydah])

## 2.24.0 (2023-09-08)

- Split `RSpec/FilePath` into `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat`. `RSpec/FilePath` cop is enabled by default, the two new cops are pending and need to be enabled explicitly. ([@ydah])
- Split `RSpec/FilePath` into `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat`. `RSpec/FilePath` cop is disabled by default and the two new cops are pending and need to be enabled explicitly. ([@ydah])
- Add new `RSpec/Eq` cop. ([@ydah])
- Add `RSpec/MetadataStyle` and `RSpec/EmptyMetadata` cops. ([@r7kamura])
- Add support `RSpec/Rails/HttpStatus` when `have_http_status` with string argument. ([@ydah])
Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ RSpec/ExpectOutput:

RSpec/FilePath:
Description: Checks that spec file paths are consistent and well-formed.
Enabled: false
Enabled: true
Include:
- "**/*_spec*rb*"
- "**/spec/**/*"
Expand Down
6 changes: 0 additions & 6 deletions config/obsoletion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,3 @@ renamed:
RSpec/FactoryBot/FactoryClassName: FactoryBot/FactoryClassName
RSpec/FactoryBot/FactoryNameStyle: FactoryBot/FactoryNameStyle
RSpec/FactoryBot/SyntaxMethods: FactoryBot/SyntaxMethods

split:
RSpec/FilePath:
alternatives:
- RSpec/SpecFilePathFormat
- RSpec/SpecFilePathSuffix
8 changes: 7 additions & 1 deletion docs/modules/ROOT/pages/cops_rspec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@ expect { my_app.print_report }.to output('Hello World').to_stdout
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Disabled
| Enabled
| Yes
| No
| 1.2
Expand All @@ -2012,6 +2012,12 @@ expect { my_app.print_report }.to output('Hello World').to_stdout

Checks that spec file paths are consistent and well-formed.

This cop is deprecated.
We plan to remove it in the next major version update to 3.0.
The migration targets are `RSpec/SpecFilePathSuffix`
and `RSpec/SpecFilePathFormat`.
If you are using this cop, please plan for migration.

By default, this checks that spec file paths are consistent with the
test subject and enforces that it reflects the described
class/module and its optionally called out method.
Expand Down
6 changes: 6 additions & 0 deletions lib/rubocop/cop/rspec/file_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module Cop
module RSpec
# Checks that spec file paths are consistent and well-formed.
#
# This cop is deprecated.
# We plan to remove it in the next major version update to 3.0.
# The migration targets are `RSpec/SpecFilePathSuffix`
# and `RSpec/SpecFilePathFormat`.
# If you are using this cop, please plan for migration.
#
# By default, this checks that spec file paths are consistent with the
# test subject and enforces that it reflects the described
# class/module and its optionally called out method.
Expand Down

0 comments on commit 195a87f

Please sign in to comment.