rubocop-capybara 2.21.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +7 -4
- data/config/default.yml +20 -2
- data/lib/rubocop/capybara/plugin.rb +38 -0
- data/lib/rubocop/capybara/version.rb +1 -1
- data/lib/rubocop/cop/capybara/ambiguous_click.rb +30 -0
- data/lib/rubocop/cop/capybara/click_link_or_button_style.rb +12 -0
- data/lib/rubocop/cop/capybara/find_all_first.rb +78 -0
- data/lib/rubocop/cop/capybara/mixin/capybara_help.rb +10 -0
- data/lib/rubocop/cop/capybara/negation_matcher.rb +9 -10
- data/lib/rubocop/cop/capybara/negation_matcher_after_visit.rb +51 -0
- data/lib/rubocop/cop/capybara/rspec/have_selector.rb +2 -1
- data/lib/rubocop/cop/capybara/rspec/predicate_matcher.rb +11 -1
- data/lib/rubocop/cop/capybara_cops.rb +3 -0
- data/lib/rubocop-capybara.rb +2 -5
- metadata +30 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03bbb0abff1aee334bbe60b255688a098b5713f6f7d675de12ede6298c6ddb87
|
4
|
+
data.tar.gz: 78faf4416bd058d5ba3442a20ffd5ac34f7f406c6e1fe5eb5fcb64ef39b61aab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29bede0e47aba00c65533df9696d675927830b50f954f3ec3ca6f7417bb036057c3089cdd986cad0327bcc73081226991acb265e8c99d6d915d5b2fdc5942ae5
|
7
|
+
data.tar.gz: bda139c9e52f5dbbac07d95304baeca8186ce23ec2cb2f9099fab7af4d2488f586026232560480eacd2fa502502a3c15742df2e0a94f57a5f548cd81c1502a65
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## Edge (Unreleased)
|
4
4
|
|
5
|
+
## 2.22.0 (2025-03-10)
|
6
|
+
|
7
|
+
- Add `Capybara/AmbiguousClick` cop and make soft-deprecated `Capybara/ClickLinkOrButtonStyle` cop. If you want to use `EnforcedStyle: strict`, use `Capybara/AmbiguousClick` cop instead. ([@ydah])
|
8
|
+
- Add new `Capybara/FindAllFirst` cop. ([@ydah])
|
9
|
+
- Add a new `Capybara/NegationMatcherAfterVisit` cop. ([@ydah])
|
10
|
+
- Fix an error for `Capybara/RSpec/HaveSelector` when passing no arguments. ([@earlopain])
|
11
|
+
- Make RuboCop Capybara work as a RuboCop plugin. ([@bquorning])
|
12
|
+
|
5
13
|
## 2.21.0 (2024-06-08)
|
6
14
|
|
7
15
|
- Fix a false negative for `Capybara/NegationMatcher` when using `to_not`. ([@ydah])
|
@@ -75,6 +83,7 @@
|
|
75
83
|
[@aried3r]: https://github.com/aried3r
|
76
84
|
[@bquorning]: https://github.com/bquorning
|
77
85
|
[@darhazer]: https://github.com/Darhazer
|
86
|
+
[@earlopain]: https://github.com/earlopain
|
78
87
|
[@onumis]: https://github.com/onumis
|
79
88
|
[@oskarsezerins]: https://github.com/OskarsEzerins
|
80
89
|
[@pirj]: https://github.com/pirj
|
data/README.md
CHANGED
@@ -31,13 +31,13 @@ ways to do this:
|
|
31
31
|
Put this into your `.rubocop.yml`.
|
32
32
|
|
33
33
|
```yaml
|
34
|
-
|
34
|
+
plugins: rubocop-capybara
|
35
35
|
```
|
36
36
|
|
37
37
|
Alternatively, use the following array notation when specifying multiple extensions.
|
38
38
|
|
39
39
|
```yaml
|
40
|
-
|
40
|
+
plugins:
|
41
41
|
- rubocop-other-extension
|
42
42
|
- rubocop-capybara
|
43
43
|
```
|
@@ -45,17 +45,20 @@ require:
|
|
45
45
|
Now you can run `rubocop` and it will automatically load the RuboCop Capybara
|
46
46
|
cops together with the standard cops.
|
47
47
|
|
48
|
+
> [!NOTE]
|
49
|
+
> The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
|
50
|
+
|
48
51
|
### Command line
|
49
52
|
|
50
53
|
```bash
|
51
|
-
rubocop --
|
54
|
+
rubocop --plugin rubocop-capybara
|
52
55
|
```
|
53
56
|
|
54
57
|
### Rake task
|
55
58
|
|
56
59
|
```ruby
|
57
60
|
RuboCop::RakeTask.new do |task|
|
58
|
-
task.
|
61
|
+
task.plugins << 'rubocop-capybara'
|
59
62
|
end
|
60
63
|
```
|
61
64
|
|
data/config/default.yml
CHANGED
@@ -9,11 +9,17 @@ Capybara:
|
|
9
9
|
- "**/*_steps.rb"
|
10
10
|
- "**/features/step_definitions/**/*"
|
11
11
|
|
12
|
+
Capybara/AmbiguousClick:
|
13
|
+
Description: Specify the exact target to click on.
|
14
|
+
Enabled: false
|
15
|
+
VersionAdded: '2.22'
|
16
|
+
Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/AmbiguousClick
|
17
|
+
|
12
18
|
Capybara/ClickLinkOrButtonStyle:
|
13
19
|
Description: Checks for methods of button or link clicks.
|
14
|
-
Enabled:
|
20
|
+
Enabled: false
|
15
21
|
VersionAdded: '2.19'
|
16
|
-
VersionChanged: '2.
|
22
|
+
VersionChanged: '2.22'
|
17
23
|
EnforcedStyle: link_or_button
|
18
24
|
SupportedStyles:
|
19
25
|
- link_or_button
|
@@ -27,6 +33,12 @@ Capybara/CurrentPathExpectation:
|
|
27
33
|
VersionChanged: '2.0'
|
28
34
|
Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/CurrentPathExpectation
|
29
35
|
|
36
|
+
Capybara/FindAllFirst:
|
37
|
+
Description: Enforces use of `first` instead of `all` with `first` or `[0]`.
|
38
|
+
Enabled: pending
|
39
|
+
VersionAdded: '2.22'
|
40
|
+
Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/FindAllFirst
|
41
|
+
|
30
42
|
Capybara/MatchStyle:
|
31
43
|
Description: Checks for usage of deprecated style methods.
|
32
44
|
Enabled: pending
|
@@ -44,6 +56,12 @@ Capybara/NegationMatcher:
|
|
44
56
|
- not_to
|
45
57
|
Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/NegationMatcher
|
46
58
|
|
59
|
+
Capybara/NegationMatcherAfterVisit:
|
60
|
+
Description: Do not allow negative matchers to be used immediately after `visit`.
|
61
|
+
Enabled: pending
|
62
|
+
VersionAdded: '2.22'
|
63
|
+
Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/NegationMatcherAfterVisit
|
64
|
+
|
47
65
|
Capybara/RedundantWithinFind:
|
48
66
|
Description: Checks for redundant `within find(...)` calls.
|
49
67
|
Enabled: pending
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Capybara
|
7
|
+
# A plugin that integrates RuboCop Capybara with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
# :nocov:
|
10
|
+
def about
|
11
|
+
LintRoller::About.new(
|
12
|
+
name: 'rubocop-capybara',
|
13
|
+
version: Version::STRING,
|
14
|
+
homepage: 'https://github.com/rubocop/rubocop-capybara',
|
15
|
+
description: 'Code style checking for Capybara test files.'
|
16
|
+
)
|
17
|
+
end
|
18
|
+
# :nocov:
|
19
|
+
|
20
|
+
def supported?(context)
|
21
|
+
context.engine == :rubocop
|
22
|
+
end
|
23
|
+
|
24
|
+
def rules(_context)
|
25
|
+
project_root = Pathname.new(__dir__).join('../../..')
|
26
|
+
|
27
|
+
obsoletion = project_root.join('config', 'obsoletion.yml')
|
28
|
+
ConfigObsoletion.files << obsoletion if obsoletion.exist?
|
29
|
+
|
30
|
+
LintRoller::Rules.new(
|
31
|
+
type: :path,
|
32
|
+
config_format: :rubocop,
|
33
|
+
value: project_root.join('config/default.yml')
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Capybara
|
6
|
+
# Specify the exact target to click on.
|
7
|
+
#
|
8
|
+
# In projects where accessibility needs to be considered,
|
9
|
+
# it is crucial to specify the click target precisely.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# # bad
|
13
|
+
# click_link_or_button('foo')
|
14
|
+
# click_on('foo')
|
15
|
+
#
|
16
|
+
# # good
|
17
|
+
# click_link('foo')
|
18
|
+
# click_button('foo')
|
19
|
+
#
|
20
|
+
class AmbiguousClick < ::RuboCop::Cop::Base
|
21
|
+
MSG = 'Use `click_link` or `click_button` instead of `%<method>s`.'
|
22
|
+
RESTRICT_ON_SEND = %i[click_link_or_button click_on].freeze
|
23
|
+
|
24
|
+
def on_send(node)
|
25
|
+
add_offense(node, message: format(MSG, method: node.method_name))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -5,6 +5,14 @@ module RuboCop
|
|
5
5
|
module Capybara
|
6
6
|
# Checks for methods of button or link clicks.
|
7
7
|
#
|
8
|
+
# This cop is deprecated.
|
9
|
+
# We plan to remove this in the next major version update to 3.0.
|
10
|
+
#
|
11
|
+
# The migration target is `Capybara/AmbiguousClick`.
|
12
|
+
# It is only migration target when `EnforcedStyle: strict`.
|
13
|
+
# If you are using this cop, please plan for migration.
|
14
|
+
# There is no migration target when `EnforcedStyle: link_or_button`.
|
15
|
+
#
|
8
16
|
# By default, prefer to use `click_link_or_button` or `click_on`.
|
9
17
|
# These methods offer a weaker coupling between the test and HTML,
|
10
18
|
# allowing for a more faithful reflection of how the user behaves.
|
@@ -59,6 +67,10 @@ module RuboCop
|
|
59
67
|
format(MSG_STRICT, method: node.method_name)
|
60
68
|
elsif style == :link_or_button
|
61
69
|
format(MSG_CLICK_LINK_OR_BUTTON, method: node.method_name)
|
70
|
+
else
|
71
|
+
# :nocov:
|
72
|
+
:noop
|
73
|
+
# :nocov:
|
62
74
|
end
|
63
75
|
end
|
64
76
|
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Capybara
|
6
|
+
# Enforces use of `first` instead of `all` with `first` or `[0]`.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
#
|
10
|
+
# # bad
|
11
|
+
# all('a').first
|
12
|
+
# all('a')[0]
|
13
|
+
# find('a', match: :first)
|
14
|
+
# all('a', match: :first)
|
15
|
+
#
|
16
|
+
# # good
|
17
|
+
# first('a')
|
18
|
+
#
|
19
|
+
class FindAllFirst < ::RuboCop::Cop::Base
|
20
|
+
extend AutoCorrector
|
21
|
+
include RangeHelp
|
22
|
+
|
23
|
+
MSG = 'Use `first(%<selector>s)`.'
|
24
|
+
RESTRICT_ON_SEND = %i[all find].freeze
|
25
|
+
|
26
|
+
# @!method find_all_first?(node)
|
27
|
+
def_node_matcher :find_all_first?, <<~PATTERN
|
28
|
+
{
|
29
|
+
(send (send _ :all _ ...) :first)
|
30
|
+
(send (send _ :all _ ...) :[] (int 0))
|
31
|
+
}
|
32
|
+
PATTERN
|
33
|
+
|
34
|
+
# @!method include_match_first?(node)
|
35
|
+
def_node_matcher :include_match_first?, <<~PATTERN
|
36
|
+
(send _ {:find :all} _ $(hash <(pair (sym :match) (sym :first)) ...>))
|
37
|
+
PATTERN
|
38
|
+
|
39
|
+
def on_send(node)
|
40
|
+
on_all_first(node)
|
41
|
+
on_match_first(node)
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def on_all_first(node)
|
47
|
+
return unless (parent = node.parent)
|
48
|
+
return unless find_all_first?(parent)
|
49
|
+
|
50
|
+
range = range_between(node.loc.selector.begin_pos,
|
51
|
+
parent.loc.selector.end_pos)
|
52
|
+
selector = node.arguments.map(&:source).join(', ')
|
53
|
+
add_offense(range,
|
54
|
+
message: format(MSG, selector: selector)) do |corrector|
|
55
|
+
corrector.replace(range, "first(#{selector})")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def on_match_first(node)
|
60
|
+
include_match_first?(node) do |hash|
|
61
|
+
selector = ([node.first_argument.source] + replaced_hash(hash))
|
62
|
+
.join(', ')
|
63
|
+
add_offense(node,
|
64
|
+
message: format(MSG, selector: selector)) do |corrector|
|
65
|
+
corrector.replace(node, "first(#{selector})")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def replaced_hash(hash)
|
71
|
+
hash.child_nodes.flat_map(&:source).reject do |arg|
|
72
|
+
arg == 'match: :first'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -6,6 +6,16 @@ module RuboCop
|
|
6
6
|
# Help methods for capybara.
|
7
7
|
# @api private
|
8
8
|
module CapybaraHelp
|
9
|
+
CAPYBARA_MATCHERS = %w[
|
10
|
+
selector css xpath text title current_path link button
|
11
|
+
field checked_field unchecked_field select table
|
12
|
+
sibling ancestor content
|
13
|
+
].freeze
|
14
|
+
POSITIVE_MATCHERS =
|
15
|
+
Set.new(CAPYBARA_MATCHERS) { |element| :"have_#{element}" }.freeze
|
16
|
+
NEGATIVE_MATCHERS =
|
17
|
+
Set.new(CAPYBARA_MATCHERS) { |element| :"have_no_#{element}" }
|
18
|
+
.freeze
|
9
19
|
COMMON_OPTIONS = %w[
|
10
20
|
id class style
|
11
21
|
].freeze
|
@@ -26,18 +26,9 @@ module RuboCop
|
|
26
26
|
class NegationMatcher < ::RuboCop::Cop::Base
|
27
27
|
extend AutoCorrector
|
28
28
|
include ConfigurableEnforcedStyle
|
29
|
+
include CapybaraHelp
|
29
30
|
|
30
31
|
MSG = 'Use `expect(...).%<runner>s %<matcher>s`.'
|
31
|
-
CAPYBARA_MATCHERS = %w[
|
32
|
-
selector css xpath text title current_path link button
|
33
|
-
field checked_field unchecked_field select table
|
34
|
-
sibling ancestor content
|
35
|
-
].freeze
|
36
|
-
POSITIVE_MATCHERS =
|
37
|
-
Set.new(CAPYBARA_MATCHERS) { |element| :"have_#{element}" }.freeze
|
38
|
-
NEGATIVE_MATCHERS =
|
39
|
-
Set.new(CAPYBARA_MATCHERS) { |element| :"have_no_#{element}" }
|
40
|
-
.freeze
|
41
32
|
RESTRICT_ON_SEND = (POSITIVE_MATCHERS + NEGATIVE_MATCHERS).freeze
|
42
33
|
|
43
34
|
# @!method not_to?(node)
|
@@ -88,6 +79,10 @@ module RuboCop
|
|
88
79
|
'to'
|
89
80
|
when :not_to
|
90
81
|
'not_to'
|
82
|
+
else
|
83
|
+
# :nocov:
|
84
|
+
:noop
|
85
|
+
# :nocov:
|
91
86
|
end
|
92
87
|
end
|
93
88
|
|
@@ -97,6 +92,10 @@ module RuboCop
|
|
97
92
|
matcher.sub('have_', 'have_no_')
|
98
93
|
when :not_to
|
99
94
|
matcher.sub('have_no_', 'have_')
|
95
|
+
else
|
96
|
+
# :nocov:
|
97
|
+
:noop
|
98
|
+
# :nocov:
|
100
99
|
end
|
101
100
|
end
|
102
101
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Capybara
|
6
|
+
# Do not allow negative matchers to be used immediately after `visit`.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # bad
|
10
|
+
# visit foo_path
|
11
|
+
# expect(page).to have_no_link('bar')
|
12
|
+
# expect(page).to have_css('a')
|
13
|
+
#
|
14
|
+
# # good
|
15
|
+
# visit foo_path
|
16
|
+
# expect(page).to have_css('a')
|
17
|
+
# expect(page).to have_no_link('bar')
|
18
|
+
#
|
19
|
+
# # bad
|
20
|
+
# visit foo_path
|
21
|
+
# expect(page).not_to have_link('bar')
|
22
|
+
# expect(page).to have_css('a')
|
23
|
+
#
|
24
|
+
# # good
|
25
|
+
# visit foo_path
|
26
|
+
# expect(page).to have_css('a')
|
27
|
+
# expect(page).not_to have_link('bar')
|
28
|
+
#
|
29
|
+
class NegationMatcherAfterVisit < ::RuboCop::Cop::Base
|
30
|
+
include CapybaraHelp
|
31
|
+
|
32
|
+
MSG = 'Do not use negation matcher immediately after visit.'
|
33
|
+
RESTRICT_ON_SEND = %i[visit].freeze
|
34
|
+
|
35
|
+
# @!method negation_matcher?(node)
|
36
|
+
def_node_matcher :negation_matcher?, <<~PATTERN
|
37
|
+
{
|
38
|
+
(send (send nil? :expect _) :to (send nil? %NEGATIVE_MATCHERS ...))
|
39
|
+
(send (send nil? :expect _) :not_to (send nil? %POSITIVE_MATCHERS ...))
|
40
|
+
}
|
41
|
+
PATTERN
|
42
|
+
|
43
|
+
def on_send(node)
|
44
|
+
negation_matcher?(node.right_sibling) do
|
45
|
+
add_offense(node.right_sibling)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -42,7 +42,8 @@ module RuboCop
|
|
42
42
|
SELECTORS = %i[css xpath].freeze
|
43
43
|
|
44
44
|
def on_send(node)
|
45
|
-
argument = node.first_argument
|
45
|
+
return unless (argument = node.first_argument)
|
46
|
+
|
46
47
|
on_select_with_type(node, argument) if argument.sym_type?
|
47
48
|
on_select_without_type(node) if %i[str dstr].include?(argument.type)
|
48
49
|
end
|
@@ -44,7 +44,7 @@ module RuboCop
|
|
44
44
|
|
45
45
|
# @!method be_bool?(node)
|
46
46
|
def_node_matcher :be_bool?, <<~PATTERN
|
47
|
-
(send nil? {:be :eq :eql :equal}
|
47
|
+
(send nil? {:be :eq :eql :equal} boolean)
|
48
48
|
PATTERN
|
49
49
|
|
50
50
|
# @!method be_boolthy?(node)
|
@@ -177,6 +177,7 @@ module RuboCop
|
|
177
177
|
"#{matcher.to_s.sub('match_', 'matches_')}?"
|
178
178
|
end
|
179
179
|
|
180
|
+
# rubocop:disable Metrics/MethodLength
|
180
181
|
def replacement_matcher(node)
|
181
182
|
case [cop_config['Strict'], node.method?(:to)]
|
182
183
|
when [true, true]
|
@@ -187,8 +188,13 @@ module RuboCop
|
|
187
188
|
'be_truthy'
|
188
189
|
when [false, false]
|
189
190
|
'be_falsey'
|
191
|
+
else
|
192
|
+
# :nocov:
|
193
|
+
:noop
|
194
|
+
# :nocov:
|
190
195
|
end
|
191
196
|
end
|
197
|
+
# rubocop:enable Metrics/MethodLength
|
192
198
|
end
|
193
199
|
|
194
200
|
# Prefer using predicate matcher over using predicate method directly.
|
@@ -248,6 +254,10 @@ module RuboCop
|
|
248
254
|
check_inflected(node)
|
249
255
|
elsif style == :explicit
|
250
256
|
check_explicit(node)
|
257
|
+
else
|
258
|
+
# :nocov:
|
259
|
+
:noop
|
260
|
+
# :nocov:
|
251
261
|
end
|
252
262
|
end
|
253
263
|
|
@@ -3,10 +3,13 @@
|
|
3
3
|
require_relative 'capybara/rspec/have_selector'
|
4
4
|
require_relative 'capybara/rspec/predicate_matcher'
|
5
5
|
|
6
|
+
require_relative 'capybara/ambiguous_click'
|
6
7
|
require_relative 'capybara/click_link_or_button_style'
|
7
8
|
require_relative 'capybara/current_path_expectation'
|
9
|
+
require_relative 'capybara/find_all_first'
|
8
10
|
require_relative 'capybara/match_style'
|
9
11
|
require_relative 'capybara/negation_matcher'
|
12
|
+
require_relative 'capybara/negation_matcher_after_visit'
|
10
13
|
require_relative 'capybara/redundant_within_find'
|
11
14
|
require_relative 'capybara/specific_actions'
|
12
15
|
require_relative 'capybara/specific_finders'
|
data/lib/rubocop-capybara.rb
CHANGED
@@ -5,17 +5,14 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
require 'rubocop'
|
7
7
|
|
8
|
+
require_relative 'rubocop/capybara/plugin'
|
9
|
+
|
8
10
|
require_relative 'rubocop/cop/capybara/mixin/capybara_help'
|
9
11
|
require_relative 'rubocop/cop/capybara/mixin/css_attributes_parser'
|
10
12
|
require_relative 'rubocop/cop/capybara/mixin/css_selector'
|
11
13
|
|
12
14
|
require_relative 'rubocop/cop/capybara_cops'
|
13
15
|
|
14
|
-
project_root = File.join(__dir__, '..')
|
15
|
-
RuboCop::ConfigLoader.inject_defaults!(project_root)
|
16
|
-
obsoletion = File.join(project_root, 'config', 'obsoletion.yml')
|
17
|
-
RuboCop::ConfigObsoletion.files << obsoletion if File.exist?(obsoletion)
|
18
|
-
|
19
16
|
RuboCop::Cop::Style::TrailingCommaInArguments.singleton_class.prepend(
|
20
17
|
Module.new do
|
21
18
|
def autocorrect_incompatible_with
|
metadata
CHANGED
@@ -1,33 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yudai Takada
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-10 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: lint_roller
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.1'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '1.1'
|
13
26
|
- !ruby/object:Gem::Dependency
|
14
27
|
name: rubocop
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
16
29
|
requirements:
|
17
30
|
- - "~>"
|
18
31
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
32
|
+
version: '1.72'
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.72.1
|
20
36
|
type: :runtime
|
21
37
|
prerelease: false
|
22
38
|
version_requirements: !ruby/object:Gem::Requirement
|
23
39
|
requirements:
|
24
40
|
- - "~>"
|
25
41
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
42
|
+
version: '1.72'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.72.1
|
27
46
|
description: |
|
28
47
|
Code style checking for Capybara test files (RSpec, Cucumber, Minitest).
|
29
48
|
A plugin for the RuboCop code style enforcing & linting tool.
|
30
|
-
email:
|
31
49
|
executables: []
|
32
50
|
extensions: []
|
33
51
|
extra_rdoc_files:
|
@@ -43,14 +61,18 @@ files:
|
|
43
61
|
- lib/rubocop/capybara/config_formatter.rb
|
44
62
|
- lib/rubocop/capybara/cop/generator.rb
|
45
63
|
- lib/rubocop/capybara/description_extractor.rb
|
64
|
+
- lib/rubocop/capybara/plugin.rb
|
46
65
|
- lib/rubocop/capybara/version.rb
|
66
|
+
- lib/rubocop/cop/capybara/ambiguous_click.rb
|
47
67
|
- lib/rubocop/cop/capybara/click_link_or_button_style.rb
|
48
68
|
- lib/rubocop/cop/capybara/current_path_expectation.rb
|
69
|
+
- lib/rubocop/cop/capybara/find_all_first.rb
|
49
70
|
- lib/rubocop/cop/capybara/match_style.rb
|
50
71
|
- lib/rubocop/cop/capybara/mixin/capybara_help.rb
|
51
72
|
- lib/rubocop/cop/capybara/mixin/css_attributes_parser.rb
|
52
73
|
- lib/rubocop/cop/capybara/mixin/css_selector.rb
|
53
74
|
- lib/rubocop/cop/capybara/negation_matcher.rb
|
75
|
+
- lib/rubocop/cop/capybara/negation_matcher_after_visit.rb
|
54
76
|
- lib/rubocop/cop/capybara/redundant_within_find.rb
|
55
77
|
- lib/rubocop/cop/capybara/rspec/have_selector.rb
|
56
78
|
- lib/rubocop/cop/capybara/rspec/predicate_matcher.rb
|
@@ -66,7 +88,7 @@ metadata:
|
|
66
88
|
changelog_uri: https://github.com/rubocop/rubocop-capybara/blob/main/CHANGELOG.md
|
67
89
|
documentation_uri: https://docs.rubocop.org/rubocop-capybara/
|
68
90
|
rubygems_mfa_required: 'true'
|
69
|
-
|
91
|
+
default_lint_roller_plugin: RuboCop::Capybara::Plugin
|
70
92
|
rdoc_options: []
|
71
93
|
require_paths:
|
72
94
|
- lib
|
@@ -81,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
103
|
- !ruby/object:Gem::Version
|
82
104
|
version: '0'
|
83
105
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
85
|
-
signing_key:
|
106
|
+
rubygems_version: 3.6.2
|
86
107
|
specification_version: 4
|
87
108
|
summary: Code style checking for Capybara test files
|
88
109
|
test_files: []
|