mangrove 0.9.1 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/README.md +1 -2
- data/docs/Mangrove/ControlFlow/ControlSignal.html +2 -2
- data/docs/Mangrove/ControlFlow.html +2 -2
- data/docs/Mangrove/Option/ControlSignal.html +2 -2
- data/docs/Mangrove/Option/None.html +2 -2
- data/docs/Mangrove/Option/Some.html +2 -2
- data/docs/Mangrove/Option.html +2 -2
- data/docs/Mangrove/Result/ControlSignal.html +2 -2
- data/docs/Mangrove/Result/Err.html +2 -2
- data/docs/Mangrove/Result/Ok.html +2 -2
- data/docs/Mangrove/Result.html +2 -2
- data/docs/Mangrove.html +3 -3
- data/docs/_index.html +8 -8
- data/docs/file.README.html +3 -5
- data/docs/index.html +3 -5
- data/docs/method_list.html +106 -106
- data/docs/top-level-namespace.html +2 -2
- data/lib/mangrove/version.rb +1 -1
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +2 -1
- data/sorbet/rbi/gems/prism@0.15.1.rbi +8 -0
- data/sorbet/rbi/gems/{rbi@0.0.17.rbi → rbi@0.1.1.rbi} +202 -248
- data/sorbet/rbi/gems/rubocop-capybara@2.19.0.rbi +1125 -0
- data/sorbet/rbi/gems/rubocop-factory_bot@2.24.0.rbi +878 -0
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +328 -0
- data/sorbet/rbi/gems/rubocop-rspec@2.24.1.rbi +7991 -0
- data/sorbet/rbi/gems/{spoom@1.2.3.rbi → spoom@1.2.4.rbi} +634 -60
- data/sorbet/rbi/gems/{syntax_tree@6.1.1.rbi → syntax_tree@6.2.0.rbi} +2495 -2214
- data/sorbet/rbi/gems/{tapioca@0.11.8.rbi → tapioca@0.11.9.rbi} +503 -356
- data/sorbet/rbi/gems/{thor@1.2.2.rbi → thor@1.3.0.rbi} +775 -395
- data/sorbet/rbi/gems/unparser@0.6.9.rbi +8 -0
- data/sorbet/rbi/gems/yarp@0.13.0.rbi +21646 -0
- metadata +21 -14
- data/sorbet/rbi/gems/unparser@0.6.8.rbi +0 -4525
- /data/sorbet/rbi/gems/{parser@3.2.2.3.rbi → parser@3.2.2.4.rbi} +0 -0
- /data/sorbet/rbi/gems/{regexp_parser@2.8.1.rbi → regexp_parser@2.8.2.rbi} +0 -0
- /data/sorbet/rbi/gems/{rubocop@1.56.0.rbi → rubocop@1.57.1.rbi} +0 -0
- /data/sorbet/rbi/gems/{ruby-lsp@0.8.0.rbi → ruby-lsp@0.12.0.rbi} +0 -0
- /data/sorbet/rbi/gems/{unicode-display_width@2.4.2.rbi → unicode-display_width@2.5.0.rbi} +0 -0
@@ -0,0 +1,1125 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rubocop-capybara` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rubocop-capybara`.
|
6
|
+
|
7
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#3
|
8
|
+
module RuboCop; end
|
9
|
+
|
10
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#4
|
11
|
+
module RuboCop::Cop; end
|
12
|
+
|
13
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#5
|
14
|
+
module RuboCop::Cop::Capybara; end
|
15
|
+
|
16
|
+
# Help methods for capybara.
|
17
|
+
#
|
18
|
+
# @api private
|
19
|
+
#
|
20
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#8
|
21
|
+
module RuboCop::Cop::Capybara::CapybaraHelp
|
22
|
+
private
|
23
|
+
|
24
|
+
# @api private
|
25
|
+
# @example
|
26
|
+
# common_attributes?('a[focused]') # => true
|
27
|
+
# common_attributes?('button[focused][visible]') # => true
|
28
|
+
# common_attributes?('table[id=some-id]') # => true
|
29
|
+
# common_attributes?('h1[invalid]') # => false
|
30
|
+
# @param selector [String]
|
31
|
+
# @return [Boolean]
|
32
|
+
#
|
33
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#61
|
34
|
+
def common_attributes?(selector); end
|
35
|
+
|
36
|
+
# @api private
|
37
|
+
# @param node [RuboCop::AST::SendNode]
|
38
|
+
# @param option [Symbol]
|
39
|
+
# @return [Boolean]
|
40
|
+
#
|
41
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#125
|
42
|
+
def include_option?(node, option); end
|
43
|
+
|
44
|
+
# @api private
|
45
|
+
# @example
|
46
|
+
# replaceable_attributes?('table[id=some-id]') # => true
|
47
|
+
# replaceable_attributes?('a[focused]') # => false
|
48
|
+
# @param attrs [Array<String>]
|
49
|
+
# @return [Boolean]
|
50
|
+
#
|
51
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#70
|
52
|
+
def replaceable_attributes?(attrs); end
|
53
|
+
|
54
|
+
# @api private
|
55
|
+
# @param node [RuboCop::AST::SendNode]
|
56
|
+
# @param element [String]
|
57
|
+
# @param attrs [Array<String>]
|
58
|
+
# @return [Boolean]
|
59
|
+
#
|
60
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#108
|
61
|
+
def replaceable_element?(node, element, attrs); end
|
62
|
+
|
63
|
+
# @api private
|
64
|
+
# @param node [RuboCop::AST::SendNode]
|
65
|
+
# @param locator [String]
|
66
|
+
# @param element [String]
|
67
|
+
# @return [Boolean]
|
68
|
+
#
|
69
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#45
|
70
|
+
def replaceable_option?(node, locator, element); end
|
71
|
+
|
72
|
+
# @api private
|
73
|
+
# @param pseudo_class [String]
|
74
|
+
# @param locator [String]
|
75
|
+
# @return [Boolean]
|
76
|
+
#
|
77
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#85
|
78
|
+
def replaceable_pseudo_class?(pseudo_class, locator); end
|
79
|
+
|
80
|
+
# @api private
|
81
|
+
# @param locator [String]
|
82
|
+
# @return [Boolean]
|
83
|
+
#
|
84
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#96
|
85
|
+
def replaceable_pseudo_class_not?(locator); end
|
86
|
+
|
87
|
+
# @api private
|
88
|
+
# @param locator [String]
|
89
|
+
# @return [Boolean]
|
90
|
+
#
|
91
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#76
|
92
|
+
def replaceable_pseudo_classes?(locator); end
|
93
|
+
|
94
|
+
# @api private
|
95
|
+
# @param node [RuboCop::AST::SendNode]
|
96
|
+
# @param attrs [Array<String>]
|
97
|
+
# @return [Boolean]
|
98
|
+
#
|
99
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#118
|
100
|
+
def replaceable_to_link?(node, attrs); end
|
101
|
+
|
102
|
+
class << self
|
103
|
+
# @api private
|
104
|
+
# @example
|
105
|
+
# common_attributes?('a[focused]') # => true
|
106
|
+
# common_attributes?('button[focused][visible]') # => true
|
107
|
+
# common_attributes?('table[id=some-id]') # => true
|
108
|
+
# common_attributes?('h1[invalid]') # => false
|
109
|
+
# @param selector [String]
|
110
|
+
# @return [Boolean]
|
111
|
+
#
|
112
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#61
|
113
|
+
def common_attributes?(selector); end
|
114
|
+
|
115
|
+
# @api private
|
116
|
+
# @param node [RuboCop::AST::SendNode]
|
117
|
+
# @param option [Symbol]
|
118
|
+
# @return [Boolean]
|
119
|
+
#
|
120
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#125
|
121
|
+
def include_option?(node, option); end
|
122
|
+
|
123
|
+
# @api private
|
124
|
+
# @example
|
125
|
+
# replaceable_attributes?('table[id=some-id]') # => true
|
126
|
+
# replaceable_attributes?('a[focused]') # => false
|
127
|
+
# @param attrs [Array<String>]
|
128
|
+
# @return [Boolean]
|
129
|
+
#
|
130
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#70
|
131
|
+
def replaceable_attributes?(attrs); end
|
132
|
+
|
133
|
+
# @api private
|
134
|
+
# @param node [RuboCop::AST::SendNode]
|
135
|
+
# @param element [String]
|
136
|
+
# @param attrs [Array<String>]
|
137
|
+
# @return [Boolean]
|
138
|
+
#
|
139
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#108
|
140
|
+
def replaceable_element?(node, element, attrs); end
|
141
|
+
|
142
|
+
# @api private
|
143
|
+
# @param node [RuboCop::AST::SendNode]
|
144
|
+
# @param locator [String]
|
145
|
+
# @param element [String]
|
146
|
+
# @return [Boolean]
|
147
|
+
#
|
148
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#45
|
149
|
+
def replaceable_option?(node, locator, element); end
|
150
|
+
|
151
|
+
# @api private
|
152
|
+
# @param pseudo_class [String]
|
153
|
+
# @param locator [String]
|
154
|
+
# @return [Boolean]
|
155
|
+
#
|
156
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#85
|
157
|
+
def replaceable_pseudo_class?(pseudo_class, locator); end
|
158
|
+
|
159
|
+
# @api private
|
160
|
+
# @param locator [String]
|
161
|
+
# @return [Boolean]
|
162
|
+
#
|
163
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#96
|
164
|
+
def replaceable_pseudo_class_not?(locator); end
|
165
|
+
|
166
|
+
# @api private
|
167
|
+
# @param locator [String]
|
168
|
+
# @return [Boolean]
|
169
|
+
#
|
170
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#76
|
171
|
+
def replaceable_pseudo_classes?(locator); end
|
172
|
+
|
173
|
+
# @api private
|
174
|
+
# @param node [RuboCop::AST::SendNode]
|
175
|
+
# @param attrs [Array<String>]
|
176
|
+
# @return [Boolean]
|
177
|
+
#
|
178
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#118
|
179
|
+
def replaceable_to_link?(node, attrs); end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# @api private
|
184
|
+
#
|
185
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#9
|
186
|
+
RuboCop::Cop::Capybara::CapybaraHelp::COMMON_OPTIONS = T.let(T.unsafe(nil), Array)
|
187
|
+
|
188
|
+
# @api private
|
189
|
+
#
|
190
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#12
|
191
|
+
RuboCop::Cop::Capybara::CapybaraHelp::SPECIFIC_OPTIONS = T.let(T.unsafe(nil), Hash)
|
192
|
+
|
193
|
+
# @api private
|
194
|
+
#
|
195
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/capybara_help.rb#35
|
196
|
+
RuboCop::Cop::Capybara::CapybaraHelp::SPECIFIC_PSEUDO_CLASSES = T.let(T.unsafe(nil), Array)
|
197
|
+
|
198
|
+
# Checks for click button or link style.
|
199
|
+
#
|
200
|
+
# @example EnforcedStyle: strict (default)
|
201
|
+
# # bad
|
202
|
+
# click_link_or_button('foo')
|
203
|
+
# click_on('foo')
|
204
|
+
#
|
205
|
+
# # good
|
206
|
+
# click_link('foo')
|
207
|
+
# click_button('foo')
|
208
|
+
# @example EnforcedStyle: link_or_button
|
209
|
+
# # bad
|
210
|
+
# click_link('foo')
|
211
|
+
# click_button('foo')
|
212
|
+
#
|
213
|
+
# # good
|
214
|
+
# click_link_or_button('foo')
|
215
|
+
# click_on('foo')
|
216
|
+
#
|
217
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#26
|
218
|
+
class RuboCop::Cop::Capybara::ClickLinkOrButtonStyle < ::RuboCop::Cop::Base
|
219
|
+
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
220
|
+
|
221
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#37
|
222
|
+
def on_send(node); end
|
223
|
+
|
224
|
+
private
|
225
|
+
|
226
|
+
# @return [Boolean]
|
227
|
+
#
|
228
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#62
|
229
|
+
def link_or_button_method?(node); end
|
230
|
+
|
231
|
+
# @return [Boolean]
|
232
|
+
#
|
233
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#45
|
234
|
+
def offense?(node); end
|
235
|
+
|
236
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#50
|
237
|
+
def offense_message(node); end
|
238
|
+
|
239
|
+
# @return [Boolean]
|
240
|
+
#
|
241
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#58
|
242
|
+
def strict_method?(node); end
|
243
|
+
end
|
244
|
+
|
245
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#34
|
246
|
+
RuboCop::Cop::Capybara::ClickLinkOrButtonStyle::CLICK_LINK_OR_BUTTON = T.let(T.unsafe(nil), Array)
|
247
|
+
|
248
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#31
|
249
|
+
RuboCop::Cop::Capybara::ClickLinkOrButtonStyle::MSG_CLICK_LINK_OR_BUTTON = T.let(T.unsafe(nil), String)
|
250
|
+
|
251
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#29
|
252
|
+
RuboCop::Cop::Capybara::ClickLinkOrButtonStyle::MSG_STRICT = T.let(T.unsafe(nil), String)
|
253
|
+
|
254
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#35
|
255
|
+
RuboCop::Cop::Capybara::ClickLinkOrButtonStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
256
|
+
|
257
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/click_link_or_button_style.rb#33
|
258
|
+
RuboCop::Cop::Capybara::ClickLinkOrButtonStyle::STRICT_METHODS = T.let(T.unsafe(nil), Array)
|
259
|
+
|
260
|
+
# Helps parsing css selector.
|
261
|
+
#
|
262
|
+
# @api private
|
263
|
+
#
|
264
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#8
|
265
|
+
module RuboCop::Cop::Capybara::CssSelector
|
266
|
+
private
|
267
|
+
|
268
|
+
# @api private
|
269
|
+
# @example
|
270
|
+
# attribute?('[attribute]') # => true
|
271
|
+
# attribute?('attribute') # => false
|
272
|
+
# @param selector [String]
|
273
|
+
# @return [Boolean]
|
274
|
+
#
|
275
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#48
|
276
|
+
def attribute?(selector); end
|
277
|
+
|
278
|
+
# @api private
|
279
|
+
# @example
|
280
|
+
# attributes('a[foo-bar_baz]') # => {"foo-bar_baz=>nil}
|
281
|
+
# attributes('button[foo][bar=baz]') # => {"foo"=>nil, "bar"=>"'baz'"}
|
282
|
+
# attributes('table[foo=bar]') # => {"foo"=>"'bar'"}
|
283
|
+
# @param selector [String]
|
284
|
+
# @return [Array<String>]
|
285
|
+
#
|
286
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#58
|
287
|
+
def attributes(selector); end
|
288
|
+
|
289
|
+
# @api private
|
290
|
+
# @example
|
291
|
+
# classes('#some-id') # => []
|
292
|
+
# classes('.some-cls') # => ['some-cls']
|
293
|
+
# classes('#some-id.some-cls') # => ['some-cls']
|
294
|
+
# classes('#some-id.cls1.cls2') # => ['cls1', 'cls2']
|
295
|
+
# @param selector [String]
|
296
|
+
# @return [Array<String>]
|
297
|
+
#
|
298
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#39
|
299
|
+
def classes(selector); end
|
300
|
+
|
301
|
+
# @api private
|
302
|
+
# @example
|
303
|
+
# id('#some-id') # => some-id
|
304
|
+
# id('.some-cls') # => nil
|
305
|
+
# id('#some-id.cls') # => some-id
|
306
|
+
# @param selector [String]
|
307
|
+
# @return [String]
|
308
|
+
#
|
309
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#17
|
310
|
+
def id(selector); end
|
311
|
+
|
312
|
+
# @api private
|
313
|
+
# @example
|
314
|
+
# id?('#some-id') # => true
|
315
|
+
# id?('.some-cls') # => false
|
316
|
+
# @param selector [String]
|
317
|
+
# @return [Boolean]
|
318
|
+
#
|
319
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#28
|
320
|
+
def id?(selector); end
|
321
|
+
|
322
|
+
# @api private
|
323
|
+
# @example
|
324
|
+
# multiple_selectors?('a.cls b#id') # => true
|
325
|
+
# multiple_selectors?('a.cls') # => false
|
326
|
+
# @param selector [String]
|
327
|
+
# @return [Boolean]
|
328
|
+
#
|
329
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#88
|
330
|
+
def multiple_selectors?(selector); end
|
331
|
+
|
332
|
+
# @api private
|
333
|
+
# @example
|
334
|
+
# normalize_value('true') # => true
|
335
|
+
# normalize_value('false') # => false
|
336
|
+
# normalize_value(nil) # => nil
|
337
|
+
# normalize_value("foo") # => "'foo'"
|
338
|
+
# @param value [String]
|
339
|
+
# @return [Boolean, String]
|
340
|
+
#
|
341
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#100
|
342
|
+
def normalize_value(value); end
|
343
|
+
|
344
|
+
# @api private
|
345
|
+
# @example
|
346
|
+
# pseudo_classes('button:not([disabled])') # => ['not()']
|
347
|
+
# pseudo_classes('a:enabled:not([valid])') # => ['enabled', 'not()']
|
348
|
+
# @param selector [String]
|
349
|
+
# @return [Array<String>]
|
350
|
+
#
|
351
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#74
|
352
|
+
def pseudo_classes(selector); end
|
353
|
+
|
354
|
+
class << self
|
355
|
+
# @api private
|
356
|
+
# @example
|
357
|
+
# attribute?('[attribute]') # => true
|
358
|
+
# attribute?('attribute') # => false
|
359
|
+
# @param selector [String]
|
360
|
+
# @return [Boolean]
|
361
|
+
#
|
362
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#48
|
363
|
+
def attribute?(selector); end
|
364
|
+
|
365
|
+
# @api private
|
366
|
+
# @example
|
367
|
+
# attributes('a[foo-bar_baz]') # => {"foo-bar_baz=>nil}
|
368
|
+
# attributes('button[foo][bar=baz]') # => {"foo"=>nil, "bar"=>"'baz'"}
|
369
|
+
# attributes('table[foo=bar]') # => {"foo"=>"'bar'"}
|
370
|
+
# @param selector [String]
|
371
|
+
# @return [Array<String>]
|
372
|
+
#
|
373
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#58
|
374
|
+
def attributes(selector); end
|
375
|
+
|
376
|
+
# @api private
|
377
|
+
# @example
|
378
|
+
# classes('#some-id') # => []
|
379
|
+
# classes('.some-cls') # => ['some-cls']
|
380
|
+
# classes('#some-id.some-cls') # => ['some-cls']
|
381
|
+
# classes('#some-id.cls1.cls2') # => ['cls1', 'cls2']
|
382
|
+
# @param selector [String]
|
383
|
+
# @return [Array<String>]
|
384
|
+
#
|
385
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#39
|
386
|
+
def classes(selector); end
|
387
|
+
|
388
|
+
# @api private
|
389
|
+
# @example
|
390
|
+
# id('#some-id') # => some-id
|
391
|
+
# id('.some-cls') # => nil
|
392
|
+
# id('#some-id.cls') # => some-id
|
393
|
+
# @param selector [String]
|
394
|
+
# @return [String]
|
395
|
+
#
|
396
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#17
|
397
|
+
def id(selector); end
|
398
|
+
|
399
|
+
# @api private
|
400
|
+
# @example
|
401
|
+
# id?('#some-id') # => true
|
402
|
+
# id?('.some-cls') # => false
|
403
|
+
# @param selector [String]
|
404
|
+
# @return [Boolean]
|
405
|
+
#
|
406
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#28
|
407
|
+
def id?(selector); end
|
408
|
+
|
409
|
+
# @api private
|
410
|
+
# @example
|
411
|
+
# multiple_selectors?('a.cls b#id') # => true
|
412
|
+
# multiple_selectors?('a.cls') # => false
|
413
|
+
# @param selector [String]
|
414
|
+
# @return [Boolean]
|
415
|
+
#
|
416
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#88
|
417
|
+
def multiple_selectors?(selector); end
|
418
|
+
|
419
|
+
# @api private
|
420
|
+
# @example
|
421
|
+
# normalize_value('true') # => true
|
422
|
+
# normalize_value('false') # => false
|
423
|
+
# normalize_value(nil) # => nil
|
424
|
+
# normalize_value("foo") # => "'foo'"
|
425
|
+
# @param value [String]
|
426
|
+
# @return [Boolean, String]
|
427
|
+
#
|
428
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#100
|
429
|
+
def normalize_value(value); end
|
430
|
+
|
431
|
+
# @api private
|
432
|
+
# @example
|
433
|
+
# pseudo_classes('button:not([disabled])') # => ['not()']
|
434
|
+
# pseudo_classes('a:enabled:not([valid])') # => ['enabled', 'not()']
|
435
|
+
# @param selector [String]
|
436
|
+
# @return [Array<String>]
|
437
|
+
#
|
438
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/mixin/css_selector.rb#74
|
439
|
+
def pseudo_classes(selector); end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
# Checks that no expectations are set on Capybara's `current_path`.
|
444
|
+
#
|
445
|
+
# The
|
446
|
+
# https://www.rubydoc.info/github/teamcapybara/capybara/master/Capybara/RSpecMatchers#have_current_path-instance_method[`have_current_path` matcher]
|
447
|
+
# should be used on `page` to set expectations on Capybara's
|
448
|
+
# current path, since it uses
|
449
|
+
# https://github.com/teamcapybara/capybara/blob/master/README.md#asynchronous-javascript-ajax-and-friends[Capybara's waiting functionality]
|
450
|
+
# which ensures that preceding actions (like `click_link`) have
|
451
|
+
# completed.
|
452
|
+
#
|
453
|
+
# This cop does not support autocorrection in some cases.
|
454
|
+
#
|
455
|
+
# @example
|
456
|
+
# # bad
|
457
|
+
# expect(current_path).to eq('/callback')
|
458
|
+
# expect(page.current_path).to eq('/callback')
|
459
|
+
#
|
460
|
+
# # good
|
461
|
+
# expect(page).to have_current_path('/callback', ignore_query: true)
|
462
|
+
#
|
463
|
+
# # bad (does not support autocorrection when `match` with a variable)
|
464
|
+
# expect(page).to match(variable)
|
465
|
+
#
|
466
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#29
|
467
|
+
class RuboCop::Cop::Capybara::CurrentPathExpectation < ::RuboCop::Cop::Base
|
468
|
+
include ::RuboCop::Cop::RangeHelp
|
469
|
+
extend ::RuboCop::Cop::AutoCorrector
|
470
|
+
|
471
|
+
# Supported matchers: eq(...) / match(/regexp/) / match('regexp')
|
472
|
+
#
|
473
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#46
|
474
|
+
def as_is_matcher(param0 = T.unsafe(nil)); end
|
475
|
+
|
476
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#40
|
477
|
+
def expectation_set_on_current_path(param0 = T.unsafe(nil)); end
|
478
|
+
|
479
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#63
|
480
|
+
def on_send(node); end
|
481
|
+
|
482
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#53
|
483
|
+
def regexp_node_matcher(param0 = T.unsafe(nil)); end
|
484
|
+
|
485
|
+
private
|
486
|
+
|
487
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#113
|
488
|
+
def add_argument_parentheses(corrector, arg_node); end
|
489
|
+
|
490
|
+
# `have_current_path` with no options will include the querystring
|
491
|
+
# while `page.current_path` does not.
|
492
|
+
# This ensures the option `ignore_query: true` is added
|
493
|
+
# except when `match` matcher.
|
494
|
+
#
|
495
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#131
|
496
|
+
def add_ignore_query_options(corrector, node, matcher_node); end
|
497
|
+
|
498
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#75
|
499
|
+
def autocorrect(corrector, node); end
|
500
|
+
|
501
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#99
|
502
|
+
def convert_regexp_node_to_literal(corrector, matcher_node, regexp_node); end
|
503
|
+
|
504
|
+
# @return [Boolean]
|
505
|
+
#
|
506
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#123
|
507
|
+
def method_call_with_no_parentheses?(arg_node); end
|
508
|
+
|
509
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#105
|
510
|
+
def regexp_node_to_regexp_expr(regexp_node); end
|
511
|
+
|
512
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#86
|
513
|
+
def rewrite_expectation(corrector, node, to_symbol, matcher_node); end
|
514
|
+
|
515
|
+
class << self
|
516
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#59
|
517
|
+
def autocorrect_incompatible_with; end
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#33
|
522
|
+
RuboCop::Cop::Capybara::CurrentPathExpectation::MSG = T.let(T.unsafe(nil), String)
|
523
|
+
|
524
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/current_path_expectation.rb#37
|
525
|
+
RuboCop::Cop::Capybara::CurrentPathExpectation::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
526
|
+
|
527
|
+
# Checks for usage of deprecated style methods.
|
528
|
+
#
|
529
|
+
# @example when using `assert_style`
|
530
|
+
# # bad
|
531
|
+
# page.find(:css, '#first').assert_style(display: 'block')
|
532
|
+
#
|
533
|
+
# # good
|
534
|
+
# page.find(:css, '#first').assert_matches_style(display: 'block')
|
535
|
+
# @example when using `has_style?`
|
536
|
+
# # bad
|
537
|
+
# expect(page.find(:css, 'first')
|
538
|
+
# .has_style?(display: 'block')).to be true
|
539
|
+
#
|
540
|
+
# # good
|
541
|
+
# expect(page.find(:css, 'first')
|
542
|
+
# .matches_style?(display: 'block')).to be true
|
543
|
+
# @example when using `have_style`
|
544
|
+
# # bad
|
545
|
+
# expect(page).to have_style(display: 'block')
|
546
|
+
#
|
547
|
+
# # good
|
548
|
+
# expect(page).to match_style(display: 'block')
|
549
|
+
#
|
550
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/match_style.rb#31
|
551
|
+
class RuboCop::Cop::Capybara::MatchStyle < ::RuboCop::Cop::Base
|
552
|
+
extend ::RuboCop::Cop::AutoCorrector
|
553
|
+
|
554
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/match_style.rb#42
|
555
|
+
def on_send(node); end
|
556
|
+
|
557
|
+
private
|
558
|
+
|
559
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/match_style.rb#52
|
560
|
+
def message(node); end
|
561
|
+
end
|
562
|
+
|
563
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/match_style.rb#34
|
564
|
+
RuboCop::Cop::Capybara::MatchStyle::MSG = T.let(T.unsafe(nil), String)
|
565
|
+
|
566
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/match_style.rb#36
|
567
|
+
RuboCop::Cop::Capybara::MatchStyle::PREFERRED_METHOD = T.let(T.unsafe(nil), Hash)
|
568
|
+
|
569
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/match_style.rb#35
|
570
|
+
RuboCop::Cop::Capybara::MatchStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
571
|
+
|
572
|
+
# Enforces use of `have_no_*` or `not_to` for negated expectations.
|
573
|
+
#
|
574
|
+
# @example EnforcedStyle: not_to (default)
|
575
|
+
# # bad
|
576
|
+
# expect(page).to have_no_selector
|
577
|
+
# expect(page).to have_no_css('a')
|
578
|
+
#
|
579
|
+
# # good
|
580
|
+
# expect(page).not_to have_selector
|
581
|
+
# expect(page).not_to have_css('a')
|
582
|
+
# @example EnforcedStyle: have_no
|
583
|
+
# # bad
|
584
|
+
# expect(page).not_to have_selector
|
585
|
+
# expect(page).not_to have_css('a')
|
586
|
+
#
|
587
|
+
# # good
|
588
|
+
# expect(page).to have_no_selector
|
589
|
+
# expect(page).to have_no_css('a')
|
590
|
+
#
|
591
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#26
|
592
|
+
class RuboCop::Cop::Capybara::NegationMatcher < ::RuboCop::Cop::Base
|
593
|
+
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
594
|
+
extend ::RuboCop::Cop::AutoCorrector
|
595
|
+
|
596
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#50
|
597
|
+
def have_no?(param0 = T.unsafe(nil)); end
|
598
|
+
|
599
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#44
|
600
|
+
def not_to?(param0 = T.unsafe(nil)); end
|
601
|
+
|
602
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#55
|
603
|
+
def on_send(node); end
|
604
|
+
|
605
|
+
private
|
606
|
+
|
607
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#78
|
608
|
+
def message(matcher); end
|
609
|
+
|
610
|
+
# @return [Boolean]
|
611
|
+
#
|
612
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#69
|
613
|
+
def offense?(node); end
|
614
|
+
|
615
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#74
|
616
|
+
def offense_range(node); end
|
617
|
+
|
618
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#93
|
619
|
+
def replaced_matcher(matcher); end
|
620
|
+
|
621
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#84
|
622
|
+
def replaced_runner; end
|
623
|
+
end
|
624
|
+
|
625
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#31
|
626
|
+
RuboCop::Cop::Capybara::NegationMatcher::CAPYBARA_MATCHERS = T.let(T.unsafe(nil), Array)
|
627
|
+
|
628
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#30
|
629
|
+
RuboCop::Cop::Capybara::NegationMatcher::MSG = T.let(T.unsafe(nil), String)
|
630
|
+
|
631
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#38
|
632
|
+
RuboCop::Cop::Capybara::NegationMatcher::NEGATIVE_MATCHERS = T.let(T.unsafe(nil), Set)
|
633
|
+
|
634
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#36
|
635
|
+
RuboCop::Cop::Capybara::NegationMatcher::POSITIVE_MATCHERS = T.let(T.unsafe(nil), Set)
|
636
|
+
|
637
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/negation_matcher.rb#41
|
638
|
+
RuboCop::Cop::Capybara::NegationMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
639
|
+
|
640
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#6
|
641
|
+
module RuboCop::Cop::Capybara::RSpec; end
|
642
|
+
|
643
|
+
# A helper for `explicit` style
|
644
|
+
#
|
645
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#108
|
646
|
+
module RuboCop::Cop::Capybara::RSpec::ExplicitHelper
|
647
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
648
|
+
|
649
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#138
|
650
|
+
def predicate_matcher?(param0 = T.unsafe(nil)); end
|
651
|
+
|
652
|
+
private
|
653
|
+
|
654
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#124
|
655
|
+
def allowed_explicit_matchers; end
|
656
|
+
|
657
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#128
|
658
|
+
def check_explicit(node); end
|
659
|
+
|
660
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#162
|
661
|
+
def corrector_explicit(corrector, to_node, actual, matcher); end
|
662
|
+
|
663
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#156
|
664
|
+
def message_explicit(matcher); end
|
665
|
+
|
666
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#169
|
667
|
+
def move_predicate(corrector, actual, matcher); end
|
668
|
+
|
669
|
+
# @return [Boolean]
|
670
|
+
#
|
671
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#149
|
672
|
+
def predicate_matcher_name?(name); end
|
673
|
+
|
674
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#180
|
675
|
+
def replacement_matcher(node); end
|
676
|
+
|
677
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#176
|
678
|
+
def to_predicate_method(matcher); end
|
679
|
+
end
|
680
|
+
|
681
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#113
|
682
|
+
RuboCop::Cop::Capybara::RSpec::ExplicitHelper::BUILT_IN_MATCHERS = T.let(T.unsafe(nil), Array)
|
683
|
+
|
684
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#118
|
685
|
+
RuboCop::Cop::Capybara::RSpec::ExplicitHelper::INFLECTED_MATCHER = T.let(T.unsafe(nil), Array)
|
686
|
+
|
687
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#111
|
688
|
+
RuboCop::Cop::Capybara::RSpec::ExplicitHelper::MSG_EXPLICIT = T.let(T.unsafe(nil), String)
|
689
|
+
|
690
|
+
# Use `have_css` or `have_xpath` instead of `have_selector`.
|
691
|
+
#
|
692
|
+
# @example
|
693
|
+
# # bad
|
694
|
+
# expect(foo).to have_selector(:css, 'bar')
|
695
|
+
#
|
696
|
+
# # good
|
697
|
+
# expect(foo).to have_css('bar')
|
698
|
+
#
|
699
|
+
# # bad
|
700
|
+
# expect(foo).to have_selector(:xpath, 'bar')
|
701
|
+
#
|
702
|
+
# # good
|
703
|
+
# expect(foo).to have_xpath('bar')
|
704
|
+
# @example DefaultSelector: css (default)
|
705
|
+
# # bad
|
706
|
+
# expect(foo).to have_selector('bar')
|
707
|
+
#
|
708
|
+
# # good
|
709
|
+
# expect(foo).to have_css('bar')
|
710
|
+
# @example DefaultSelector: xpath
|
711
|
+
# # bad
|
712
|
+
# expect(foo).to have_selector('bar')
|
713
|
+
#
|
714
|
+
# # good
|
715
|
+
# expect(foo).to have_xpath('bar')
|
716
|
+
#
|
717
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#36
|
718
|
+
class RuboCop::Cop::Capybara::RSpec::HaveSelector < ::RuboCop::Cop::Base
|
719
|
+
include ::RuboCop::Cop::RangeHelp
|
720
|
+
extend ::RuboCop::Cop::AutoCorrector
|
721
|
+
|
722
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#44
|
723
|
+
def on_send(node); end
|
724
|
+
|
725
|
+
private
|
726
|
+
|
727
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#80
|
728
|
+
def default_selector; end
|
729
|
+
|
730
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#65
|
731
|
+
def deletion_range(first_argument, second_argument); end
|
732
|
+
|
733
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#61
|
734
|
+
def message_typed(type); end
|
735
|
+
|
736
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#76
|
737
|
+
def message_untyped; end
|
738
|
+
|
739
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#52
|
740
|
+
def on_select_with_type(node, type); end
|
741
|
+
|
742
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#70
|
743
|
+
def on_select_without_type(node); end
|
744
|
+
end
|
745
|
+
|
746
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#40
|
747
|
+
RuboCop::Cop::Capybara::RSpec::HaveSelector::MSG = T.let(T.unsafe(nil), String)
|
748
|
+
|
749
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#41
|
750
|
+
RuboCop::Cop::Capybara::RSpec::HaveSelector::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
751
|
+
|
752
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/have_selector.rb#42
|
753
|
+
RuboCop::Cop::Capybara::RSpec::HaveSelector::SELECTORS = T.let(T.unsafe(nil), Array)
|
754
|
+
|
755
|
+
# A helper for `inflected` style
|
756
|
+
#
|
757
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#8
|
758
|
+
module RuboCop::Cop::Capybara::RSpec::InflectedHelper
|
759
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
760
|
+
|
761
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#46
|
762
|
+
def be_bool?(param0 = T.unsafe(nil)); end
|
763
|
+
|
764
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#51
|
765
|
+
def be_boolthy?(param0 = T.unsafe(nil)); end
|
766
|
+
|
767
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#32
|
768
|
+
def predicate_in_actual?(param0 = T.unsafe(nil)); end
|
769
|
+
|
770
|
+
private
|
771
|
+
|
772
|
+
# @return [Boolean]
|
773
|
+
#
|
774
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#55
|
775
|
+
def boolean_matcher?(node); end
|
776
|
+
|
777
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#19
|
778
|
+
def check_inflected(node); end
|
779
|
+
|
780
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#67
|
781
|
+
def message_inflected(predicate); end
|
782
|
+
|
783
|
+
# @return [Boolean]
|
784
|
+
#
|
785
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#63
|
786
|
+
def predicate?(sym); end
|
787
|
+
|
788
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#77
|
789
|
+
def remove_predicate(corrector, predicate); end
|
790
|
+
|
791
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#85
|
792
|
+
def rewrite_matcher(corrector, predicate, matcher); end
|
793
|
+
|
794
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#73
|
795
|
+
def to_predicate_matcher(name); end
|
796
|
+
|
797
|
+
# @return [Boolean]
|
798
|
+
#
|
799
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#94
|
800
|
+
def true?(to_symbol, matcher); end
|
801
|
+
end
|
802
|
+
|
803
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#11
|
804
|
+
RuboCop::Cop::Capybara::RSpec::InflectedHelper::EXPLICIT_MATCHER = T.let(T.unsafe(nil), Array)
|
805
|
+
|
806
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#14
|
807
|
+
RuboCop::Cop::Capybara::RSpec::InflectedHelper::MSG_INFLECTED = T.let(T.unsafe(nil), String)
|
808
|
+
|
809
|
+
# Prefer using predicate matcher over using predicate method directly.
|
810
|
+
#
|
811
|
+
# Capybara defines magic matchers for predicate methods.
|
812
|
+
# This cop recommends to use the predicate matcher instead of using
|
813
|
+
# predicate method directly.
|
814
|
+
#
|
815
|
+
# @example Strict: true, EnforcedStyle: inflected (default)
|
816
|
+
# # bad
|
817
|
+
# expect(foo.matches_css?(bar: 'baz')).to be_truthy
|
818
|
+
# expect(foo.matches_selector?(bar: 'baz')).to be_truthy
|
819
|
+
# expect(foo.matches_style?(bar: 'baz')).to be_truthy
|
820
|
+
# expect(foo.matches_xpath?(bar: 'baz')).to be_truthy
|
821
|
+
#
|
822
|
+
# # good
|
823
|
+
# expect(foo).to match_css(bar: 'baz')
|
824
|
+
# expect(foo).to match_selector(bar: 'baz')
|
825
|
+
# expect(foo).to match_style(bar: 'baz')
|
826
|
+
# expect(foo).to match_xpath(bar: 'baz')
|
827
|
+
#
|
828
|
+
# # also good - It checks "true" strictly.
|
829
|
+
# expect(foo.matches_style?(bar: 'baz')).to be(true)
|
830
|
+
# @example Strict: false, EnforcedStyle: inflected
|
831
|
+
# # bad
|
832
|
+
# expect(foo.matches_style?(bar: 'baz')).to be_truthy
|
833
|
+
# expect(foo.matches_style?(bar: 'baz')).to be(true)
|
834
|
+
#
|
835
|
+
# # good
|
836
|
+
# expect(foo).to match_style(bar: 'baz')
|
837
|
+
# @example Strict: true, EnforcedStyle: explicit
|
838
|
+
# # bad
|
839
|
+
# expect(foo).to match_style(bar: 'baz')
|
840
|
+
#
|
841
|
+
# # good - the above code is rewritten to it by this cop
|
842
|
+
# expect(foo.matches_style?(bar: 'baz')).to be(true)
|
843
|
+
# @example Strict: false, EnforcedStyle: explicit
|
844
|
+
# # bad
|
845
|
+
# expect(foo).to match_style(bar: 'baz')
|
846
|
+
#
|
847
|
+
# # good - the above code is rewritten to it by this cop
|
848
|
+
# expect(foo.matches_style?(bar: 'baz')).to be_truthy
|
849
|
+
#
|
850
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#238
|
851
|
+
class RuboCop::Cop::Capybara::RSpec::PredicateMatcher < ::RuboCop::Cop::Base
|
852
|
+
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
853
|
+
include ::RuboCop::Cop::Capybara::RSpec::InflectedHelper
|
854
|
+
include ::RuboCop::Cop::Capybara::RSpec::ExplicitHelper
|
855
|
+
extend ::RuboCop::Cop::AutoCorrector
|
856
|
+
|
857
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#246
|
858
|
+
def on_send(node); end
|
859
|
+
|
860
|
+
private
|
861
|
+
|
862
|
+
# returns args location with whitespace
|
863
|
+
#
|
864
|
+
# @example
|
865
|
+
# foo 1, 2
|
866
|
+
# ^^^^^
|
867
|
+
#
|
868
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#260
|
869
|
+
def args_loc(send_node); end
|
870
|
+
end
|
871
|
+
|
872
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/rspec/predicate_matcher.rb#244
|
873
|
+
RuboCop::Cop::Capybara::RSpec::PredicateMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
874
|
+
|
875
|
+
# Checks for there is a more specific actions offered by Capybara.
|
876
|
+
#
|
877
|
+
# @example
|
878
|
+
#
|
879
|
+
# # bad
|
880
|
+
# find('a').click
|
881
|
+
# find('button.cls').click
|
882
|
+
# find('a', exact_text: 'foo').click
|
883
|
+
# find('div button').click
|
884
|
+
#
|
885
|
+
# # good
|
886
|
+
# click_link
|
887
|
+
# click_button(class: 'cls')
|
888
|
+
# click_link(exact_text: 'foo')
|
889
|
+
# find('div').click_button
|
890
|
+
#
|
891
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#22
|
892
|
+
class RuboCop::Cop::Capybara::SpecificActions < ::RuboCop::Cop::Base
|
893
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#31
|
894
|
+
def click_on_selector(param0 = T.unsafe(nil)); end
|
895
|
+
|
896
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#35
|
897
|
+
def on_send(node); end
|
898
|
+
|
899
|
+
private
|
900
|
+
|
901
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#87
|
902
|
+
def good_action(action); end
|
903
|
+
|
904
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#73
|
905
|
+
def last_selector(arg); end
|
906
|
+
|
907
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#81
|
908
|
+
def message(action, selector); end
|
909
|
+
|
910
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#77
|
911
|
+
def offense_range(node, receiver); end
|
912
|
+
|
913
|
+
# @return [Boolean]
|
914
|
+
#
|
915
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#57
|
916
|
+
def replaceable?(node, arg, action); end
|
917
|
+
|
918
|
+
# @return [Boolean]
|
919
|
+
#
|
920
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#63
|
921
|
+
def replaceable_attributes?(selector); end
|
922
|
+
|
923
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#53
|
924
|
+
def specific_action(selector); end
|
925
|
+
|
926
|
+
# @return [Boolean]
|
927
|
+
#
|
928
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#69
|
929
|
+
def supported_selector?(selector); end
|
930
|
+
end
|
931
|
+
|
932
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#23
|
933
|
+
RuboCop::Cop::Capybara::SpecificActions::MSG = T.let(T.unsafe(nil), String)
|
934
|
+
|
935
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#24
|
936
|
+
RuboCop::Cop::Capybara::SpecificActions::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
937
|
+
|
938
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_actions.rb#25
|
939
|
+
RuboCop::Cop::Capybara::SpecificActions::SPECIFIC_ACTION = T.let(T.unsafe(nil), Hash)
|
940
|
+
|
941
|
+
# Checks if there is a more specific finder offered by Capybara.
|
942
|
+
#
|
943
|
+
# @example
|
944
|
+
# # bad
|
945
|
+
# find('#some-id')
|
946
|
+
# find('[id=some-id]')
|
947
|
+
# find(:css, '#some-id')
|
948
|
+
#
|
949
|
+
# # good
|
950
|
+
# find_by_id('some-id')
|
951
|
+
#
|
952
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#17
|
953
|
+
class RuboCop::Cop::Capybara::SpecificFinders < ::RuboCop::Cop::Base
|
954
|
+
include ::RuboCop::Cop::RangeHelp
|
955
|
+
extend ::RuboCop::Cop::AutoCorrector
|
956
|
+
|
957
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#30
|
958
|
+
def class_options(param0); end
|
959
|
+
|
960
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#25
|
961
|
+
def find_argument(param0 = T.unsafe(nil)); end
|
962
|
+
|
963
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#34
|
964
|
+
def on_send(node); end
|
965
|
+
|
966
|
+
private
|
967
|
+
|
968
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#93
|
969
|
+
def append_options(classes, options); end
|
970
|
+
|
971
|
+
# @return [Boolean]
|
972
|
+
#
|
973
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#62
|
974
|
+
def attribute?(arg); end
|
975
|
+
|
976
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#83
|
977
|
+
def autocorrect_classes(corrector, node, classes); end
|
978
|
+
|
979
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#78
|
980
|
+
def deletion_range(node); end
|
981
|
+
|
982
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#120
|
983
|
+
def end_pos(node); end
|
984
|
+
|
985
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#98
|
986
|
+
def keyword_argument_class(classes); end
|
987
|
+
|
988
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#116
|
989
|
+
def offense_range(node); end
|
990
|
+
|
991
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#46
|
992
|
+
def on_attr(node, sym, arg); end
|
993
|
+
|
994
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#54
|
995
|
+
def on_id(node, sym, arg); end
|
996
|
+
|
997
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#67
|
998
|
+
def register_offense(node, sym, id, classes = T.unsafe(nil)); end
|
999
|
+
|
1000
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#103
|
1001
|
+
def replaced_arguments(arg, id); end
|
1002
|
+
|
1003
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#108
|
1004
|
+
def to_options(attrs); end
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#21
|
1008
|
+
RuboCop::Cop::Capybara::SpecificFinders::MSG = T.let(T.unsafe(nil), String)
|
1009
|
+
|
1010
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_finders.rb#22
|
1011
|
+
RuboCop::Cop::Capybara::SpecificFinders::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1012
|
+
|
1013
|
+
# Checks for there is a more specific matcher offered by Capybara.
|
1014
|
+
#
|
1015
|
+
# @example
|
1016
|
+
#
|
1017
|
+
# # bad
|
1018
|
+
# expect(page).to have_selector('button')
|
1019
|
+
# expect(page).to have_no_selector('button.cls')
|
1020
|
+
# expect(page).to have_css('button')
|
1021
|
+
# expect(page).to have_no_css('a.cls', href: 'http://example.com')
|
1022
|
+
# expect(page).to have_css('table.cls')
|
1023
|
+
# expect(page).to have_css('select')
|
1024
|
+
# expect(page).to have_css('input', exact_text: 'foo')
|
1025
|
+
#
|
1026
|
+
# # good
|
1027
|
+
# expect(page).to have_button
|
1028
|
+
# expect(page).to have_no_button(class: 'cls')
|
1029
|
+
# expect(page).to have_button
|
1030
|
+
# expect(page).to have_no_link('foo', class: 'cls', href: 'http://example.com')
|
1031
|
+
# expect(page).to have_table(class: 'cls')
|
1032
|
+
# expect(page).to have_select
|
1033
|
+
# expect(page).to have_field('foo')
|
1034
|
+
#
|
1035
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#28
|
1036
|
+
class RuboCop::Cop::Capybara::SpecificMatcher < ::RuboCop::Cop::Base
|
1037
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#41
|
1038
|
+
def first_argument(param0 = T.unsafe(nil)); end
|
1039
|
+
|
1040
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#45
|
1041
|
+
def on_send(node); end
|
1042
|
+
|
1043
|
+
private
|
1044
|
+
|
1045
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#80
|
1046
|
+
def good_matcher(node, matcher); end
|
1047
|
+
|
1048
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#74
|
1049
|
+
def message(node, matcher); end
|
1050
|
+
|
1051
|
+
# @return [Boolean]
|
1052
|
+
#
|
1053
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#62
|
1054
|
+
def replaceable?(node, arg, matcher); end
|
1055
|
+
|
1056
|
+
# @return [Boolean]
|
1057
|
+
#
|
1058
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#68
|
1059
|
+
def replaceable_attributes?(selector); end
|
1060
|
+
|
1061
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#57
|
1062
|
+
def specific_matcher(arg); end
|
1063
|
+
end
|
1064
|
+
|
1065
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#29
|
1066
|
+
RuboCop::Cop::Capybara::SpecificMatcher::MSG = T.let(T.unsafe(nil), String)
|
1067
|
+
|
1068
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#30
|
1069
|
+
RuboCop::Cop::Capybara::SpecificMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1070
|
+
|
1071
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/specific_matcher.rb#32
|
1072
|
+
RuboCop::Cop::Capybara::SpecificMatcher::SPECIFIC_MATCHER = T.let(T.unsafe(nil), Hash)
|
1073
|
+
|
1074
|
+
# Checks for boolean visibility in Capybara finders.
|
1075
|
+
#
|
1076
|
+
# Capybara lets you find elements that match a certain visibility using
|
1077
|
+
# the `:visible` option. `:visible` accepts both boolean and symbols as
|
1078
|
+
# values, however using booleans can have unwanted effects. `visible:
|
1079
|
+
# false` does not find just invisible elements, but both visible and
|
1080
|
+
# invisible elements. For expressiveness and clarity, use one of the
|
1081
|
+
# symbol values, `:all`, `:hidden` or `:visible`.
|
1082
|
+
# Read more in
|
1083
|
+
# https://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FFinders:all[the documentation].
|
1084
|
+
#
|
1085
|
+
# @example
|
1086
|
+
# # bad
|
1087
|
+
# expect(page).to have_selector('.foo', visible: false)
|
1088
|
+
# expect(page).to have_css('.foo', visible: true)
|
1089
|
+
# expect(page).to have_link('my link', visible: false)
|
1090
|
+
#
|
1091
|
+
# # good
|
1092
|
+
# expect(page).to have_selector('.foo', visible: :visible)
|
1093
|
+
# expect(page).to have_css('.foo', visible: :all)
|
1094
|
+
# expect(page).to have_link('my link', visible: :hidden)
|
1095
|
+
#
|
1096
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#28
|
1097
|
+
class RuboCop::Cop::Capybara::VisibilityMatcher < ::RuboCop::Cop::Base
|
1098
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#58
|
1099
|
+
def on_send(node); end
|
1100
|
+
|
1101
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#54
|
1102
|
+
def visible_false?(param0 = T.unsafe(nil)); end
|
1103
|
+
|
1104
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#49
|
1105
|
+
def visible_true?(param0 = T.unsafe(nil)); end
|
1106
|
+
|
1107
|
+
private
|
1108
|
+
|
1109
|
+
# @return [Boolean]
|
1110
|
+
#
|
1111
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#65
|
1112
|
+
def capybara_matcher?(method_name); end
|
1113
|
+
end
|
1114
|
+
|
1115
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#31
|
1116
|
+
RuboCop::Cop::Capybara::VisibilityMatcher::CAPYBARA_MATCHER_METHODS = T.let(T.unsafe(nil), Array)
|
1117
|
+
|
1118
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#29
|
1119
|
+
RuboCop::Cop::Capybara::VisibilityMatcher::MSG_FALSE = T.let(T.unsafe(nil), String)
|
1120
|
+
|
1121
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#30
|
1122
|
+
RuboCop::Cop::Capybara::VisibilityMatcher::MSG_TRUE = T.let(T.unsafe(nil), String)
|
1123
|
+
|
1124
|
+
# source://rubocop-capybara//lib/rubocop/cop/capybara/visibility_matcher.rb#46
|
1125
|
+
RuboCop::Cop::Capybara::VisibilityMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|