Skip to content

Commit 1fa9ce3

Browse files
committed
Remove RSpec/Capybara/FeatureMethods
Fix: rubocop#1852
1 parent 5d2ec84 commit 1fa9ce3

File tree

14 files changed

+39
-364
lines changed

14 files changed

+39
-364
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Remove extracted cops in `Capybara`, `FactoryBot` and `Rails` departments. ([@ydah])
66
- Remove `RuboCop::RSpec::Language::NodePattern`. ([@ydah])
77
- Remove `RSpec/FilePath` cop. ([@ydah])
8+
- Remove `RSpec/Capybara/FeatureMethods` cop. If you are using this cop, change it to use `RSpec/Dialect`. ([@ydah])
89

910
## 2.29.2 (2024-05-02)
1011

Rakefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ task :build_config do
3333
require 'rubocop/rspec/config_formatter'
3434
require 'rubocop/rspec/description_extractor'
3535

36-
glob = File.join('lib', 'rubocop', 'cop', 'rspec',
37-
'{,capybara}', '*.rb')
36+
glob = File.join('lib', 'rubocop', 'cop', 'rspec', '*.rb')
3837
# Due to YARD's sensitivity to file require order (as of 0.9.25),
3938
# we have to prepend the list with our base cop, RuboCop::Cop::RSpec::Base.
4039
# Otherwise, cop's parent class for cops loaded before our base cop class

config/default.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ RSpec:
33
Enabled: true
44
StyleGuideBaseURL: https://rspec.rubystyle.guide
55
DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec
6-
Include: &1
6+
Include:
77
- "**/*_spec.rb"
88
- "**/spec/**/*"
9-
Language: &2
9+
Language:
1010
inherit_mode:
1111
merge:
1212
- Expectations
@@ -990,16 +990,3 @@ RSpec/Yield:
990990
Enabled: true
991991
VersionAdded: '1.32'
992992
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
993-
994-
RSpec/Capybara:
995-
Enabled: true
996-
Include: *1
997-
Language: *2
998-
999-
RSpec/Capybara/FeatureMethods:
1000-
Description: Checks for consistent method usage in feature specs.
1001-
Enabled: true
1002-
EnabledMethods: []
1003-
VersionAdded: '1.17'
1004-
VersionChanged: '2.0'
1005-
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods

config/obsoletion.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ split:
4040
alternatives:
4141
- RSpec/SpecFilePathFormat
4242
- RSpec/SpecFilePathSuffix
43+
44+
removed:
45+
RSpec/Capybara/FeatureMethods:
46+
reason: >
47+
this cop has migrated to `RSpec/Dialect`. Please use `RSpec/Dialect` instead

docs/modules/ROOT/pages/cops.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,4 @@
111111
* xref:cops_rspec.adoc#rspecvoidexpect[RSpec/VoidExpect]
112112
* xref:cops_rspec.adoc#rspecyield[RSpec/Yield]
113113

114-
=== Department xref:cops_rspec_capybara.adoc[RSpec/Capybara]
115-
116-
* xref:cops_rspec_capybara.adoc#rspeccapybara/featuremethods[RSpec/Capybara/FeatureMethods]
117-
118114
// END_COP_LIST

docs/modules/ROOT/pages/cops_rspec.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,19 @@ a config like:
10731073
PreferredMethods:
10741074
context: describe
10751075
1076+
If you were previously using the `RSpec/Capybara/FeatureMethods` cop and
1077+
want to keep disabling all Capybara-specific methods that have the same
1078+
native RSpec method (e.g. are just aliases), use the following config:
1079+
1080+
RSpec/Dialect:
1081+
PreferredMethods:
1082+
background: :before
1083+
scenario: :it
1084+
xscenario: :xit
1085+
given: :let
1086+
given!: :let!
1087+
feature: :describe
1088+
10761089
You can expect the following behavior:
10771090
10781091
=== Examples

docs/modules/ROOT/pages/cops_rspec_capybara.adoc

Lines changed: 0 additions & 74 deletions
This file was deleted.

lib/rubocop/cop/rspec/capybara/feature_methods.rb

Lines changed: 0 additions & 104 deletions
This file was deleted.

lib/rubocop/cop/rspec/dialect.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ module RSpec
2929
# PreferredMethods:
3030
# context: describe
3131
#
32+
# If you were previously using the `RSpec/Capybara/FeatureMethods` cop and
33+
# want to keep disabling all Capybara-specific methods that have the same
34+
# native RSpec method (e.g. are just aliases), use the following config:
35+
#
36+
# RSpec/Dialect:
37+
# PreferredMethods:
38+
# background: :before
39+
# scenario: :it
40+
# xscenario: :xit
41+
# given: :let
42+
# given!: :let!
43+
# feature: :describe
44+
#
3245
# You can expect the following behavior:
3346
#
3447
# @example

lib/rubocop/cop/rspec_cops.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative 'rspec/capybara/feature_methods'
4-
53
require_relative 'rspec/align_left_let_brace'
64
require_relative 'rspec/align_right_let_brace'
75
require_relative 'rspec/any_instance'

0 commit comments

Comments
 (0)