rubocop-rspec 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/config/default.yml +125 -125
- data/lib/rubocop/cop/rspec/around_block.rb +1 -1
- data/lib/rubocop/cop/rspec/be.rb +1 -1
- data/lib/rubocop/cop/rspec/before_after_all.rb +3 -3
- data/lib/rubocop/cop/rspec/describe_class.rb +1 -1
- data/lib/rubocop/cop/rspec/describe_method.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_actual.rb +1 -0
- data/lib/rubocop/cop/rspec/expect_output.rb +1 -1
- data/lib/rubocop/cop/rspec/instance_spy.rb +1 -1
- data/lib/rubocop/cop/rspec/it_behaves_like.rb +1 -1
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +1 -1
- data/lib/rubocop/cop/rspec/message_spies.rb +2 -2
- data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -2
- data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
- data/lib/rubocop/cop/rspec/shared_context.rb +2 -5
- data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +1 -1
- data/lib/rubocop/cop/rspec/subject_stub.rb +14 -4
- data/lib/rubocop/rspec/config_formatter.rb +3 -1
- data/lib/rubocop/rspec/node.rb +1 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddf35b53864596c6fb017de51fcb89ba77720471a3eaa2dd02f250da1b434ffe
|
4
|
+
data.tar.gz: a1aefe9d16cccac1d0d3d3bb19704e46cc91041c9f9c83f26cabbf419d75e162
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 677edcd80bb8883e1c786f7a3d8665eac1082341652b050b2188f8cd242b5c632181f569081e7c656765a2abb8ce453c074aa1d1b7dd7304b830928da157bcc9
|
7
|
+
data.tar.gz: 8b0a8211d5593d0bd20e984ff0daad1473c8b4ab75d7068aad3018dbc1b9036aa731d0c7aff7f12f9df8dbde91f554b4aabc002940000597ba2c8c4ee391ca5b
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 2.0.1 (2020-12-02)
|
6
|
+
|
7
|
+
* Fixed infinite loop in `RSpec/ExpectActual` autocorrection when both expected and actual values are literals. ([@Darhazer][])
|
8
|
+
|
5
9
|
## 2.0.0 (2020-11-06)
|
6
10
|
|
7
11
|
* Remove deprecated class `::RuboCop::Cop::RSpec::Cop`. ([@bquorning][])
|
data/README.md
CHANGED
@@ -71,7 +71,7 @@ rubocop-rspec is available on Code Climate as part of the rubocop engine. [Learn
|
|
71
71
|
|
72
72
|
## Documentation
|
73
73
|
|
74
|
-
You can read more about RuboCop
|
74
|
+
You can read more about RuboCop RSpec in its [official manual](https://docs.rubocop.org/rubocop-rspec).
|
75
75
|
|
76
76
|
## The Cops
|
77
77
|
|
data/config/default.yml
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
---
|
2
2
|
RSpec:
|
3
3
|
Include:
|
4
|
-
|
5
|
-
|
4
|
+
- "**/*_spec.rb"
|
5
|
+
- "**/spec/**/*"
|
6
6
|
Language:
|
7
7
|
ExampleGroups:
|
8
8
|
Regular:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
- describe
|
10
|
+
- context
|
11
|
+
- feature
|
12
|
+
- example_group
|
13
13
|
Skipped:
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
- xdescribe
|
15
|
+
- xcontext
|
16
|
+
- xfeature
|
17
17
|
Focused:
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
- fdescribe
|
19
|
+
- fcontext
|
20
|
+
- ffeature
|
21
21
|
Examples:
|
22
22
|
Regular:
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
- it
|
24
|
+
- specify
|
25
|
+
- example
|
26
|
+
- scenario
|
27
|
+
- its
|
28
28
|
Focused:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
- fit
|
30
|
+
- fspecify
|
31
|
+
- fexample
|
32
|
+
- fscenario
|
33
|
+
- focus
|
34
34
|
Skipped:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
- xit
|
36
|
+
- xspecify
|
37
|
+
- xexample
|
38
|
+
- xscenario
|
39
|
+
- skip
|
40
40
|
Pending:
|
41
|
-
|
41
|
+
- pending
|
42
42
|
Expectations:
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
- expect
|
44
|
+
- is_expected
|
45
|
+
- expect_any_instance_of
|
46
46
|
Helpers:
|
47
|
-
|
48
|
-
|
47
|
+
- let
|
48
|
+
- let!
|
49
49
|
Hooks:
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
- prepend_before
|
51
|
+
- before
|
52
|
+
- append_before
|
53
|
+
- around
|
54
|
+
- prepend_after
|
55
|
+
- after
|
56
|
+
- append_after
|
57
57
|
HookScopes:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
- each
|
59
|
+
- example
|
60
|
+
- context
|
61
|
+
- all
|
62
|
+
- suite
|
63
63
|
Includes:
|
64
64
|
Examples:
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
- it_behaves_like
|
66
|
+
- it_should_behave_like
|
67
|
+
- include_examples
|
68
68
|
Context:
|
69
|
-
|
69
|
+
- include_context
|
70
70
|
Runners:
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
- to
|
72
|
+
- to_not
|
73
|
+
- not_to
|
74
74
|
SharedGroups:
|
75
75
|
Examples:
|
76
|
-
|
77
|
-
|
76
|
+
- shared_examples
|
77
|
+
- shared_examples_for
|
78
78
|
Context:
|
79
|
-
|
79
|
+
- shared_context
|
80
80
|
Subjects:
|
81
|
-
|
82
|
-
|
81
|
+
- subject
|
82
|
+
- subject!
|
83
83
|
|
84
84
|
RSpec/AlignLeftLetBrace:
|
85
85
|
Description: Checks that left braces for adjacent single line lets are aligned.
|
@@ -121,9 +121,9 @@ RSpec/BeforeAfterAll:
|
|
121
121
|
Description: Check that before/after(:all) isn't being used.
|
122
122
|
Enabled: true
|
123
123
|
Exclude:
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- spec/rails_helper.rb
|
126
|
+
- spec/support/**/*.rb
|
127
127
|
VersionAdded: '1.12'
|
128
128
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
129
129
|
|
@@ -137,9 +137,9 @@ RSpec/ContextWording:
|
|
137
137
|
Description: Checks that `context` docstring starts with an allowed prefix.
|
138
138
|
Enabled: true
|
139
139
|
Prefixes:
|
140
|
-
|
141
|
-
|
142
|
-
|
140
|
+
- when
|
141
|
+
- with
|
142
|
+
- without
|
143
143
|
VersionAdded: '1.20'
|
144
144
|
VersionChanged: 1.20.1
|
145
145
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
@@ -149,19 +149,19 @@ RSpec/DescribeClass:
|
|
149
149
|
Enabled: true
|
150
150
|
IgnoredMetadata:
|
151
151
|
type:
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
152
|
+
- channel
|
153
|
+
- controller
|
154
|
+
- helper
|
155
|
+
- job
|
156
|
+
- mailer
|
157
|
+
- model
|
158
|
+
- request
|
159
|
+
- routing
|
160
|
+
- view
|
161
|
+
- feature
|
162
|
+
- system
|
163
|
+
- mailbox
|
164
|
+
- aruba
|
165
165
|
VersionAdded: '1.0'
|
166
166
|
VersionChanged: '1.44'
|
167
167
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
@@ -184,8 +184,8 @@ RSpec/DescribedClass:
|
|
184
184
|
SkipBlocks: false
|
185
185
|
EnforcedStyle: described_class
|
186
186
|
SupportedStyles:
|
187
|
-
|
188
|
-
|
187
|
+
- described_class
|
188
|
+
- explicit
|
189
189
|
SafeAutoCorrect: false
|
190
190
|
VersionAdded: '1.0'
|
191
191
|
VersionChanged: '1.11'
|
@@ -260,9 +260,9 @@ RSpec/ExampleWithoutDescription:
|
|
260
260
|
Enabled: true
|
261
261
|
EnforcedStyle: always_allow
|
262
262
|
SupportedStyles:
|
263
|
-
|
264
|
-
|
265
|
-
|
263
|
+
- always_allow
|
264
|
+
- single_line_only
|
265
|
+
- disallow
|
266
266
|
VersionAdded: '1.22'
|
267
267
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
268
268
|
|
@@ -283,7 +283,7 @@ RSpec/ExpectActual:
|
|
283
283
|
Description: Checks for `expect(...)` calls containing literal values.
|
284
284
|
Enabled: true
|
285
285
|
Exclude:
|
286
|
-
|
286
|
+
- spec/routing/**/*
|
287
287
|
VersionAdded: '1.7'
|
288
288
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
289
289
|
|
@@ -292,8 +292,8 @@ RSpec/ExpectChange:
|
|
292
292
|
Enabled: true
|
293
293
|
EnforcedStyle: method_call
|
294
294
|
SupportedStyles:
|
295
|
-
|
296
|
-
|
295
|
+
- method_call
|
296
|
+
- block
|
297
297
|
VersionAdded: '1.22'
|
298
298
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
299
299
|
|
@@ -313,8 +313,8 @@ RSpec/FilePath:
|
|
313
313
|
Description: Checks that spec file paths are consistent and well-formed.
|
314
314
|
Enabled: true
|
315
315
|
Include:
|
316
|
-
|
317
|
-
|
316
|
+
- "**/*_spec*rb*"
|
317
|
+
- "**/spec/**/*"
|
318
318
|
CustomTransform:
|
319
319
|
RuboCop: rubocop
|
320
320
|
RSpec: rspec
|
@@ -335,9 +335,9 @@ RSpec/HookArgument:
|
|
335
335
|
Enabled: true
|
336
336
|
EnforcedStyle: implicit
|
337
337
|
SupportedStyles:
|
338
|
-
|
339
|
-
|
340
|
-
|
338
|
+
- implicit
|
339
|
+
- each
|
340
|
+
- example
|
341
341
|
VersionAdded: '1.7'
|
342
342
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
|
343
343
|
|
@@ -358,8 +358,8 @@ RSpec/ImplicitExpect:
|
|
358
358
|
Enabled: true
|
359
359
|
EnforcedStyle: is_expected
|
360
360
|
SupportedStyles:
|
361
|
-
|
362
|
-
|
361
|
+
- is_expected
|
362
|
+
- should
|
363
363
|
VersionAdded: '1.8'
|
364
364
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
|
365
365
|
|
@@ -368,9 +368,9 @@ RSpec/ImplicitSubject:
|
|
368
368
|
Enabled: true
|
369
369
|
EnforcedStyle: single_line_only
|
370
370
|
SupportedStyles:
|
371
|
-
|
372
|
-
|
373
|
-
|
371
|
+
- single_line_only
|
372
|
+
- single_statement_only
|
373
|
+
- disallow
|
374
374
|
VersionAdded: '1.29'
|
375
375
|
VersionChanged: '1.30'
|
376
376
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
|
@@ -394,8 +394,8 @@ RSpec/ItBehavesLike:
|
|
394
394
|
Enabled: true
|
395
395
|
EnforcedStyle: it_behaves_like
|
396
396
|
SupportedStyles:
|
397
|
-
|
398
|
-
|
397
|
+
- it_behaves_like
|
398
|
+
- it_should_behave_like
|
399
399
|
VersionAdded: '1.13'
|
400
400
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
|
401
401
|
|
@@ -442,8 +442,8 @@ RSpec/MessageExpectation:
|
|
442
442
|
Enabled: false
|
443
443
|
EnforcedStyle: allow
|
444
444
|
SupportedStyles:
|
445
|
-
|
446
|
-
|
445
|
+
- allow
|
446
|
+
- expect
|
447
447
|
VersionAdded: '1.7'
|
448
448
|
VersionChanged: '1.8'
|
449
449
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
|
@@ -453,8 +453,8 @@ RSpec/MessageSpies:
|
|
453
453
|
Enabled: true
|
454
454
|
EnforcedStyle: have_received
|
455
455
|
SupportedStyles:
|
456
|
-
|
457
|
-
|
456
|
+
- have_received
|
457
|
+
- receive
|
458
458
|
VersionAdded: '1.9'
|
459
459
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
460
460
|
|
@@ -512,8 +512,8 @@ RSpec/NotToNot:
|
|
512
512
|
Enabled: true
|
513
513
|
EnforcedStyle: not_to
|
514
514
|
SupportedStyles:
|
515
|
-
|
516
|
-
|
515
|
+
- not_to
|
516
|
+
- to_not
|
517
517
|
VersionAdded: '1.4'
|
518
518
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
|
519
519
|
|
@@ -536,8 +536,8 @@ RSpec/PredicateMatcher:
|
|
536
536
|
EnforcedStyle: inflected
|
537
537
|
AllowedExplicitMatchers: []
|
538
538
|
SupportedStyles:
|
539
|
-
|
540
|
-
|
539
|
+
- inflected
|
540
|
+
- explicit
|
541
541
|
SafeAutoCorrect: false
|
542
542
|
VersionAdded: '1.16'
|
543
543
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
|
@@ -589,8 +589,8 @@ RSpec/ReturnFromStub:
|
|
589
589
|
Enabled: true
|
590
590
|
EnforcedStyle: and_return
|
591
591
|
SupportedStyles:
|
592
|
-
|
593
|
-
|
592
|
+
- and_return
|
593
|
+
- block
|
594
594
|
VersionAdded: '1.16'
|
595
595
|
VersionChanged: '1.22'
|
596
596
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
|
@@ -650,8 +650,8 @@ RSpec/VariableDefinition:
|
|
650
650
|
Enabled: true
|
651
651
|
EnforcedStyle: symbols
|
652
652
|
SupportedStyles:
|
653
|
-
|
654
|
-
|
653
|
+
- symbols
|
654
|
+
- strings
|
655
655
|
VersionAdded: '1.40'
|
656
656
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
|
657
657
|
|
@@ -660,8 +660,8 @@ RSpec/VariableName:
|
|
660
660
|
Enabled: true
|
661
661
|
EnforcedStyle: snake_case
|
662
662
|
SupportedStyles:
|
663
|
-
|
664
|
-
|
663
|
+
- snake_case
|
664
|
+
- camelCase
|
665
665
|
IgnoredPatterns: []
|
666
666
|
VersionAdded: '1.40'
|
667
667
|
VersionChanged: '1.43'
|
@@ -714,9 +714,9 @@ RSpec/FactoryBot/AttributeDefinedStatically:
|
|
714
714
|
Description: Always declare attribute values as blocks.
|
715
715
|
Enabled: true
|
716
716
|
Include:
|
717
|
-
|
718
|
-
|
719
|
-
|
717
|
+
- spec/factories.rb
|
718
|
+
- spec/factories/**/*.rb
|
719
|
+
- features/support/factories/**/*.rb
|
720
720
|
VersionAdded: '1.28'
|
721
721
|
VersionChanged: '2.0'
|
722
722
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
@@ -725,15 +725,15 @@ RSpec/FactoryBot/CreateList:
|
|
725
725
|
Description: Checks for create_list usage.
|
726
726
|
Enabled: true
|
727
727
|
Include:
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
728
|
+
- "**/*_spec.rb"
|
729
|
+
- "**/spec/**/*"
|
730
|
+
- spec/factories.rb
|
731
|
+
- spec/factories/**/*.rb
|
732
|
+
- features/support/factories/**/*.rb
|
733
733
|
EnforcedStyle: create_list
|
734
734
|
SupportedStyles:
|
735
|
-
|
736
|
-
|
735
|
+
- create_list
|
736
|
+
- n_times
|
737
737
|
VersionAdded: '1.25'
|
738
738
|
VersionChanged: '2.0'
|
739
739
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
@@ -742,9 +742,9 @@ RSpec/FactoryBot/FactoryClassName:
|
|
742
742
|
Description: Use string value when setting the class attribute explicitly.
|
743
743
|
Enabled: true
|
744
744
|
Include:
|
745
|
-
|
746
|
-
|
747
|
-
|
745
|
+
- spec/factories.rb
|
746
|
+
- spec/factories/**/*.rb
|
747
|
+
- features/support/factories/**/*.rb
|
748
748
|
VersionAdded: '1.37'
|
749
749
|
VersionChanged: '2.0'
|
750
750
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
@@ -754,8 +754,8 @@ RSpec/Rails/HttpStatus:
|
|
754
754
|
Enabled: true
|
755
755
|
EnforcedStyle: symbolic
|
756
756
|
SupportedStyles:
|
757
|
-
|
758
|
-
|
757
|
+
- numeric
|
758
|
+
- symbolic
|
759
759
|
VersionAdded: '1.23'
|
760
760
|
VersionChanged: '2.0'
|
761
761
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
@@ -27,7 +27,7 @@ module RuboCop
|
|
27
27
|
# end
|
28
28
|
class AroundBlock < Base
|
29
29
|
MSG_NO_ARG = 'Test object should be passed to around block.'
|
30
|
-
MSG_UNUSED_ARG = 'You should call `%<arg>s.call` '\
|
30
|
+
MSG_UNUSED_ARG = 'You should call `%<arg>s.call` ' \
|
31
31
|
'or `%<arg>s.run`.'
|
32
32
|
|
33
33
|
def_node_matcher :hook, <<-PATTERN
|
data/lib/rubocop/cop/rspec/be.rb
CHANGED
@@ -24,9 +24,9 @@ module RuboCop
|
|
24
24
|
# after(:each) { Widget.delete_all }
|
25
25
|
# end
|
26
26
|
class BeforeAfterAll < Base
|
27
|
-
MSG = 'Beware of using `%<hook>s` as it may cause state to leak '\
|
28
|
-
'between tests. If you are using `rspec-rails`, and '\
|
29
|
-
'`use_transactional_fixtures` is enabled, then records created '\
|
27
|
+
MSG = 'Beware of using `%<hook>s` as it may cause state to leak ' \
|
28
|
+
'between tests. If you are using `rspec-rails`, and ' \
|
29
|
+
'`use_transactional_fixtures` is enabled, then records created ' \
|
30
30
|
'in `%<hook>s` are not automatically rolled back.'
|
31
31
|
|
32
32
|
def_node_matcher :before_or_after_all, <<-PATTERN
|
@@ -37,7 +37,7 @@ module RuboCop
|
|
37
37
|
class DescribeClass < Base
|
38
38
|
include TopLevelGroup
|
39
39
|
|
40
|
-
MSG = 'The first argument to describe should be '\
|
40
|
+
MSG = 'The first argument to describe should be ' \
|
41
41
|
'the class or module being tested.'
|
42
42
|
|
43
43
|
def_node_matcher :example_group_with_ignored_metadata?, <<~PATTERN
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
class DescribeMethod < Base
|
20
20
|
include TopLevelGroup
|
21
21
|
|
22
|
-
MSG = 'The second argument to describe should be the method '\
|
22
|
+
MSG = 'The second argument to describe should be the method ' \
|
23
23
|
"being tested. '#instance' or '.class'."
|
24
24
|
|
25
25
|
def_node_matcher :second_argument, <<~PATTERN
|
@@ -15,7 +15,7 @@ module RuboCop
|
|
15
15
|
# # good
|
16
16
|
# expect { my_app.print_report }.to output('Hello World').to_stdout
|
17
17
|
class ExpectOutput < Base
|
18
|
-
MSG = 'Use `expect { ... }.to output(...).to_%<name>s` '\
|
18
|
+
MSG = 'Use `expect { ... }.to output(...).to_%<name>s` ' \
|
19
19
|
'instead of mutating $%<name>s.'
|
20
20
|
|
21
21
|
def on_gvasgn(node)
|
@@ -21,7 +21,7 @@ module RuboCop
|
|
21
21
|
class InstanceSpy < Base
|
22
22
|
extend AutoCorrector
|
23
23
|
|
24
|
-
MSG = 'Use `instance_spy` when you check your double '\
|
24
|
+
MSG = 'Use `instance_spy` when you check your double ' \
|
25
25
|
'with `have_received`.'
|
26
26
|
|
27
27
|
def_node_search :null_double, <<-PATTERN
|
@@ -22,7 +22,7 @@ module RuboCop
|
|
22
22
|
extend AutoCorrector
|
23
23
|
include ConfigurableEnforcedStyle
|
24
24
|
|
25
|
-
MSG = 'Prefer `%<replacement>s` over `%<original>s` when including '\
|
25
|
+
MSG = 'Prefer `%<replacement>s` over `%<original>s` when including ' \
|
26
26
|
'examples in a nested context.'
|
27
27
|
|
28
28
|
def_node_matcher :example_inclusion_offense, '(send _ % ...)'
|
@@ -29,8 +29,8 @@ module RuboCop
|
|
29
29
|
|
30
30
|
MSG_RECEIVE = 'Prefer `receive` for setting message expectations.'
|
31
31
|
|
32
|
-
MSG_HAVE_RECEIVED = 'Prefer `have_received` for setting message '\
|
33
|
-
'expectations. Setup `%<source>s` as a spy using '\
|
32
|
+
MSG_HAVE_RECEIVED = 'Prefer `have_received` for setting message ' \
|
33
|
+
'expectations. Setup `%<source>s` as a spy using ' \
|
34
34
|
'`allow` or `instance_spy`.'
|
35
35
|
|
36
36
|
SUPPORTED_STYLES = %w[have_received receive].freeze
|
@@ -25,8 +25,7 @@ module RuboCop
|
|
25
25
|
class MultipleDescribes < Base
|
26
26
|
include TopLevelGroup
|
27
27
|
|
28
|
-
MSG = 'Do not use multiple top-level example groups - '
|
29
|
-
'try to nest them.'
|
28
|
+
MSG = 'Do not use multiple top-level example groups - try to nest them.'
|
30
29
|
|
31
30
|
def on_top_level_group(node)
|
32
31
|
top_level_example_groups =
|
@@ -23,7 +23,7 @@ module RuboCop
|
|
23
23
|
# end
|
24
24
|
#
|
25
25
|
class ScatteredSetup < Base
|
26
|
-
MSG = 'Do not define multiple `%<hook_name>s` hooks in the same '\
|
26
|
+
MSG = 'Do not define multiple `%<hook_name>s` hooks in the same ' \
|
27
27
|
'example group (also defined on %<lines>s).'
|
28
28
|
|
29
29
|
def on_block(node)
|
@@ -53,11 +53,8 @@ module RuboCop
|
|
53
53
|
class SharedContext < Base
|
54
54
|
extend AutoCorrector
|
55
55
|
|
56
|
-
MSG_EXAMPLES = "Use `shared_examples` when you don't "
|
57
|
-
|
58
|
-
|
59
|
-
MSG_CONTEXT = "Use `shared_context` when you don't "\
|
60
|
-
'define examples.'
|
56
|
+
MSG_EXAMPLES = "Use `shared_examples` when you don't define context."
|
57
|
+
MSG_CONTEXT = "Use `shared_context` when you don't define examples."
|
61
58
|
|
62
59
|
def_node_search :examples?,
|
63
60
|
send_pattern('{#Includes.examples #Examples.all}')
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
class SingleArgumentMessageChain < Base
|
20
20
|
extend AutoCorrector
|
21
21
|
|
22
|
-
MSG = 'Use `%<recommended>s` instead of calling '\
|
22
|
+
MSG = 'Use `%<recommended>s` instead of calling ' \
|
23
23
|
'`%<called>s` with a single argument.'
|
24
24
|
|
25
25
|
def_node_matcher :message_chain, <<-PATTERN
|
@@ -13,11 +13,21 @@ module RuboCop
|
|
13
13
|
#
|
14
14
|
# @example
|
15
15
|
# # bad
|
16
|
-
# describe
|
17
|
-
# subject(:
|
16
|
+
# describe Article do
|
17
|
+
# subject(:article) { Article.new }
|
18
18
|
#
|
19
|
-
#
|
20
|
-
# allow(
|
19
|
+
# it 'indicates that the author is unknown' do
|
20
|
+
# allow(article).to receive(:author).and_return(nil)
|
21
|
+
# expect(article.description).to include('by an unknown author')
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# # good
|
26
|
+
# describe Article do
|
27
|
+
# subject(:article) { Article.new(author: nil) }
|
28
|
+
#
|
29
|
+
# it 'indicates that the author is unknown' do
|
30
|
+
# expect(article.description).to include('by an unknown author')
|
21
31
|
# end
|
22
32
|
# end
|
23
33
|
#
|
data/lib/rubocop/rspec/node.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Backus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|