rubocop-rspec 2.22.0 → 2.27.1
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 +94 -9
- data/README.md +1 -1
- data/config/default.yml +126 -21
- data/lib/rubocop/cop/rspec/around_block.rb +3 -3
- data/lib/rubocop/cop/rspec/be.rb +1 -1
- data/lib/rubocop/cop/rspec/be_empty.rb +1 -0
- data/lib/rubocop/cop/rspec/be_eq.rb +1 -1
- data/lib/rubocop/cop/rspec/be_eql.rb +1 -1
- data/lib/rubocop/cop/rspec/be_nil.rb +2 -2
- data/lib/rubocop/cop/rspec/before_after_all.rb +7 -13
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +2 -2
- data/lib/rubocop/cop/rspec/change_by_zero.rb +30 -4
- data/lib/rubocop/cop/rspec/context_method.rb +2 -2
- data/lib/rubocop/cop/rspec/context_wording.rb +1 -1
- data/lib/rubocop/cop/rspec/describe_symbol.rb +1 -1
- data/lib/rubocop/cop/rspec/described_class.rb +33 -11
- data/lib/rubocop/cop/rspec/duplicated_metadata.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_example_group.rb +4 -1
- data/lib/rubocop/cop/rspec/empty_line_after_example.rb +2 -2
- data/lib/rubocop/cop/rspec/empty_metadata.rb +46 -0
- data/lib/rubocop/cop/rspec/eq.rb +47 -0
- data/lib/rubocop/cop/rspec/example_length.rb +11 -5
- data/lib/rubocop/cop/rspec/example_without_description.rb +11 -2
- data/lib/rubocop/cop/rspec/example_wording.rb +11 -2
- data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +14 -5
- data/lib/rubocop/cop/rspec/expect_actual.rb +7 -4
- data/lib/rubocop/cop/rspec/expect_change.rb +2 -2
- data/lib/rubocop/cop/rspec/expect_output.rb +1 -4
- data/lib/rubocop/cop/rspec/file_path.rb +6 -0
- data/lib/rubocop/cop/rspec/focus.rb +17 -2
- data/lib/rubocop/cop/rspec/hook_argument.rb +2 -2
- data/lib/rubocop/cop/rspec/hooks_before_examples.rb +1 -1
- data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +2 -2
- data/lib/rubocop/cop/rspec/implicit_expect.rb +1 -1
- data/lib/rubocop/cop/rspec/implicit_subject.rb +2 -2
- data/lib/rubocop/cop/rspec/indexed_let.rb +32 -1
- data/lib/rubocop/cop/rspec/instance_spy.rb +2 -2
- data/lib/rubocop/cop/rspec/instance_variable.rb +3 -3
- data/lib/rubocop/cop/rspec/is_expected_specify.rb +45 -0
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +3 -3
- data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -1
- data/lib/rubocop/cop/rspec/let_before_examples.rb +5 -1
- data/lib/rubocop/cop/rspec/let_setup.rb +1 -1
- data/lib/rubocop/cop/rspec/message_expectation.rb +1 -2
- data/lib/rubocop/cop/rspec/message_spies.rb +0 -2
- data/lib/rubocop/cop/rspec/metadata_style.rb +202 -0
- data/lib/rubocop/cop/rspec/mixin/file_help.rb +14 -0
- data/lib/rubocop/cop/rspec/mixin/metadata.rb +21 -7
- data/lib/rubocop/cop/rspec/mixin/skip_or_pending.rb +2 -2
- data/lib/rubocop/cop/rspec/multiple_expectations.rb +12 -7
- data/lib/rubocop/cop/rspec/named_subject.rb +1 -1
- data/lib/rubocop/cop/rspec/pending.rb +12 -2
- data/lib/rubocop/cop/rspec/pending_without_reason.rb +1 -1
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +9 -9
- data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +1 -1
- data/lib/rubocop/cop/rspec/rails/have_http_status.rb +34 -10
- data/lib/rubocop/cop/rspec/rails/http_status.rb +29 -18
- data/lib/rubocop/cop/rspec/rails/minitest_assertions.rb +314 -22
- data/lib/rubocop/cop/rspec/rails/negation_be_valid.rb +102 -0
- data/lib/rubocop/cop/rspec/receive_counts.rb +1 -1
- data/lib/rubocop/cop/rspec/receive_messages.rb +161 -0
- data/lib/rubocop/cop/rspec/redundant_predicate_matcher.rb +67 -0
- data/lib/rubocop/cop/rspec/remove_const.rb +40 -0
- data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +1 -1
- data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +2 -2
- data/lib/rubocop/cop/rspec/repeated_include_example.rb +1 -1
- data/lib/rubocop/cop/rspec/repeated_subject_call.rb +124 -0
- data/lib/rubocop/cop/rspec/return_from_stub.rb +1 -1
- data/lib/rubocop/cop/rspec/shared_context.rb +1 -1
- data/lib/rubocop/cop/rspec/shared_examples.rb +66 -20
- data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +2 -3
- data/lib/rubocop/cop/rspec/sort_metadata.rb +2 -1
- data/lib/rubocop/cop/rspec/spec_file_path_format.rb +133 -0
- data/lib/rubocop/cop/rspec/spec_file_path_suffix.rb +40 -0
- data/lib/rubocop/cop/rspec/stubbed_mock.rb +1 -1
- data/lib/rubocop/cop/rspec/subject_stub.rb +4 -4
- data/lib/rubocop/cop/rspec/unspecified_exception.rb +2 -2
- data/lib/rubocop/cop/rspec/variable_definition.rb +4 -4
- data/lib/rubocop/cop/rspec/verified_double_reference.rb +6 -6
- data/lib/rubocop/cop/rspec/verified_doubles.rb +2 -2
- data/lib/rubocop/cop/rspec/void_expect.rb +4 -3
- data/lib/rubocop/cop/rspec_cops.rb +11 -0
- data/lib/rubocop/rspec/language.rb +8 -8
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop/rspec/wording.rb +8 -0
- data/lib/rubocop-rspec.rb +1 -0
- metadata +20 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 629669f9a1d9d41dae7bc62c630f3a6cdae80623d3213c8e79ac8eb207f79e59
|
4
|
+
data.tar.gz: 5005161c3684fcd8b794284bcaeedc50253a545d649be9e0e0a82958fdd125b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8af331d4b31697228397a1122cbe331223d3f040f44d2260e5148d73177df5ba08ae2aea1d481b27f698b5d59c9522d1c5f4c5e08e14b473a548de75ccf218c6
|
7
|
+
data.tar.gz: 0f86ea257bcd14e73c57b2e431f618e0959cf9dbeca6e22c4b75bd8d4945f670d8fdb65212ff12969b351b62c35f845ca28041d4b1b30627e7d64dda5932b365
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,79 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 2.27.1 (2024-03-03)
|
6
|
+
|
7
|
+
- Fix a false positive for `RSpec/RepeatedSubjectCall` when `subject.method_call`. ([@ydah])
|
8
|
+
- Add configuration option `OnlyStaticConstants` to `RSpec/DescribedClass`. ([@ydah])
|
9
|
+
|
10
|
+
## 2.27.0 (2024-03-01)
|
11
|
+
|
12
|
+
- Add new `RSpec/IsExpectedSpecify` cop. ([@ydah])
|
13
|
+
- Add new `RSpec/RepeatedSubjectCall` cop. ([@drcapulet])
|
14
|
+
- Add support for `assert_true`, `assert_false`, `assert_not_equal`, `assert_not_nil`, `*_empty`, `*_predicate`, `*_kind_of`, `*_in_delta`, `*_match`, `*_instance_of` and `*_includes` assertions in `RSpec/Rails/MinitestAssertions`. ([@ydah], [@G-Rath])
|
15
|
+
- Support asserts with messages in `Rspec/BeEmpty`. ([@G-Rath])
|
16
|
+
- Fix a false positive for `RSpec/ExpectActual` when used with rspec-rails routing matchers. ([@naveg])
|
17
|
+
- Add configuration option `ResponseMethods` to `RSpec/Rails/HaveHttpStatus`. ([@ydah])
|
18
|
+
- Fix a false negative for `RSpec/DescribedClass` when class with constant. ([@ydah])
|
19
|
+
- Fix a false positive for `RSpec/ExampleWithoutDescription` when `specify` with multi-line block and missing description. ([@ydah])
|
20
|
+
- Fix an incorrect autocorrect for `RSpec/ChangeByZero` when compound expectations with line break before `.by(0)`. ([@ydah])
|
21
|
+
|
22
|
+
## 2.26.1 (2024-01-05)
|
23
|
+
|
24
|
+
- Fix an error for `RSpec/SharedExamples` when using examples without argument. ([@ydah])
|
25
|
+
|
26
|
+
## 2.26.0 (2024-01-04)
|
27
|
+
|
28
|
+
- Add new `RSpec/RedundantPredicateMatcher` cop. ([@ydah])
|
29
|
+
- Add new `RSpec/RemoveConst` cop. ([@swelther])
|
30
|
+
- Add support for correcting "it will" (future tense) for `RSpec/ExampleWording`. ([@jdufresne])
|
31
|
+
- Add support for `symbol` style for `RSpec/SharedExamples`. ([@jessieay])
|
32
|
+
- Ensure `PendingWithoutReason` can detect violations inside shared groups. ([@robinaugh])
|
33
|
+
|
34
|
+
## 2.25.0 (2023-10-27)
|
35
|
+
|
36
|
+
- Add support single quoted string and percent string and heredoc for `RSpec/Rails/HttpStatus`. ([@ydah])
|
37
|
+
- Change to be inline disable for `RSpec/SpecFilePathFormat` like `RSpec/FilePath`. ([@ydah])
|
38
|
+
- Fix a false positive for `RSpec/MetadataStyle` with example groups having multiple string arguments. ([@franzliedke])
|
39
|
+
|
40
|
+
## 2.24.1 (2023-09-23)
|
41
|
+
|
42
|
+
- Fix an error when using `RSpec/FilePath` and revert to enabled by default. If you have already moved to `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat`, disable `RSpec/FilePath` explicitly as `Enabled: false`. The `RSpec/FilePath` before migration and the `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat` as the target are available respectively. ([@ydah])
|
43
|
+
|
44
|
+
## 2.24.0 (2023-09-08)
|
45
|
+
|
46
|
+
- Split `RSpec/FilePath` into `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat`. `RSpec/FilePath` cop is disabled by default and the two new cops are pending and need to be enabled explicitly. ([@ydah])
|
47
|
+
- Add new `RSpec/Eq` cop. ([@ydah])
|
48
|
+
- Add `RSpec/MetadataStyle` and `RSpec/EmptyMetadata` cops. ([@r7kamura])
|
49
|
+
- Add support `RSpec/Rails/HttpStatus` when `have_http_status` with string argument. ([@ydah])
|
50
|
+
- Fix an infinite loop error when `RSpec/ExcessiveDocstringSpacing` finds a description with non-ASCII leading/trailing whitespace. ([@bcgraham])
|
51
|
+
- Fix an incorrect autocorrect for `RSpec/ReceiveMessages` when return values declared between stubs. ([@marocchino])
|
52
|
+
- Fix a false positive `RSpec/Focus` when chained method call and inside define method. ([@ydah])
|
53
|
+
|
54
|
+
## 2.23.2 (2023-08-09)
|
55
|
+
|
56
|
+
- Fix an incorrect autocorrect for `RSpec/ReceiveMessages` when method is only non-word character. ([@marocchino])
|
57
|
+
- Fix a false positive for `RSpec/ReceiveMessages` when return with splat. ([@marocchino])
|
58
|
+
|
59
|
+
## 2.23.1 (2023-08-07)
|
60
|
+
|
61
|
+
- Mark to `Safe: false` for `RSpec/Rails/NegationBeValid` cop. ([@ydah])
|
62
|
+
- Declare autocorrect as unsafe for `RSpec/ReceiveMessages`. ([@bquorning])
|
63
|
+
|
64
|
+
## 2.23.0 (2023-07-30)
|
65
|
+
|
66
|
+
- Add new `RSpec/Rails/NegationBeValid` cop. ([@ydah])
|
67
|
+
- Fix a false negative for `RSpec/ExcessiveDocstringSpacing` when finds description with em space. ([@ydah])
|
68
|
+
- Fix a false positive for `RSpec/EmptyExampleGroup` when example group with examples defined in `if` branch inside iterator. ([@ydah])
|
69
|
+
- Update the message output of `RSpec/ExpectActual` to include the word 'value'. ([@corydiamand])
|
70
|
+
- Fix a false negative for `RSpec/Pending` when `it` without body. ([@ydah])
|
71
|
+
- Add new `RSpec/ReceiveMessages` cop. ([@ydah])
|
72
|
+
- Change default.yml path to use `**/spec/*` instead of `spec/*`. ([@ydah])
|
73
|
+
- Add `AllowedIdentifiers` and `AllowedPatterns` configuration option to `RSpec/IndexedLet`. ([@ydah])
|
74
|
+
- Fix `RSpec/NamedSubject` when block has no body. ([@splattael])
|
75
|
+
- Fix `RSpec/LetBeforeExamples` autocorrect incompatible with `RSpec/ScatteredLet` autocorrect. ([@ydah])
|
76
|
+
- Update `RSpec/Focus` to support `shared_context` and `shared_examples`. ([@tmaier])
|
77
|
+
|
5
78
|
## 2.22.0 (2023-05-06)
|
6
79
|
|
7
80
|
- Extract factory_bot cops to a separate repository, [`rubocop-factory_bot`](https://github.com/rubocop/rubocop-factory_bot). The `rubocop-factory_bot` repository is a dependency of `rubocop-rspec` and the factory_bot cops are aliased (`RSpec/FactoryBot/Foo` == `FactoryBot/Foo`) until v3.0 is released, so the change will be invisible to users until then. ([@ydah])
|
@@ -22,9 +95,9 @@
|
|
22
95
|
- Add support `be_status` style for `RSpec/Rails/HttpStatus`. ([@ydah])
|
23
96
|
- Add support for shared example groups to `RSpec/EmptyLineAfterExampleGroup`. ([@pirj])
|
24
97
|
- Add support for `RSpec/HaveHttpStatus` when using `response.code`. ([@ydah])
|
25
|
-
- Fix order of expected and actual in correction for `RSpec/Rails/MinitestAssertions
|
98
|
+
- Fix order of expected and actual in correction for `RSpec/Rails/MinitestAssertions`. ([@mvz])
|
26
99
|
- Fix a false positive for `RSpec/DescribedClassModuleWrapping` when RSpec.describe numblock is nested within a module. ([@ydah])
|
27
|
-
- Fix a false positive for `RSpec/FactoryBot/ConsistentParenthesesStyle` inside `&&`, `||` and `:?` when `omit_parentheses` is on ([@dmitrytsepelev])
|
100
|
+
- Fix a false positive for `RSpec/FactoryBot/ConsistentParenthesesStyle` inside `&&`, `||` and `:?` when `omit_parentheses` is on. ([@dmitrytsepelev])
|
28
101
|
- Fix a false positive for `RSpec/PendingWithoutReason` when pending/skip has a reason inside an example group. ([@ydah])
|
29
102
|
- Fix a false negative for `RSpec/RedundantAround` when redundant numblock `around`. ([@ydah])
|
30
103
|
- Change `RSpec/ContainExactly` to ignore calls with no arguments, and change `RSpec/MatchArray` to ignore calls with an empty array literal argument. ([@ydah], [@bquorning])
|
@@ -77,7 +150,7 @@
|
|
77
150
|
- Improved processing speed for `RSpec/Be`, `RSpec/ExpectActual`, `RSpec/ImplicitExpect`, `RSpec/MessageSpies`, `RSpec/PredicateMatcher` and `RSpec/Rails/HaveHttpStatus`. ([@ydah])
|
78
151
|
- Fix wrong autocorrection in `n_times` style on `RSpec/FactoryBot/CreateList`. ([@r7kamura])
|
79
152
|
- Fix a false positive for `RSpec/FactoryBot/ConsistentParenthesesStyle` when using `generate` with multiple arguments. ([@ydah])
|
80
|
-
- Mark `RSpec/BeEq` as `Safe: false
|
153
|
+
- Mark `RSpec/BeEq` as `Safe: false`. ([@r7kamura])
|
81
154
|
- Add `RSpec/DuplicatedMetadata` cop. ([@r7kamura])
|
82
155
|
- Mark `RSpec/BeEql` as `Safe: false`. ([@r7kamura])
|
83
156
|
- Add `RSpec/PendingWithoutReason` cop. ([@r7kamura])
|
@@ -110,8 +183,8 @@
|
|
110
183
|
- Fix a false positive for `RSpec/Capybara/SpecificMatcher` when `have_css("a")` without attribute. ([@ydah])
|
111
184
|
- Update `RSpec/ExampleWording` cop to raise error for insufficient descriptions. ([@akrox58])
|
112
185
|
- Add new `RSpec/Capybara/NegationMatcher` cop. ([@ydah])
|
113
|
-
- Add `AllowedPatterns` configuration option to `RSpec/NoExpectationExample`.
|
114
|
-
- Improve `RSpec/NoExpectationExample` cop to ignore examples skipped or pending via metadata.
|
186
|
+
- Add `AllowedPatterns` configuration option to `RSpec/NoExpectationExample`. ([@ydah])
|
187
|
+
- Improve `RSpec/NoExpectationExample` cop to ignore examples skipped or pending via metadata. ([@pirj])
|
115
188
|
- Add `RSpec/FactoryBot/ConsistentParenthesesStyle` cop. ([@Liberatys])
|
116
189
|
- Add `RSpec/Rails/InferredSpecType` cop. ([@r7kamura])
|
117
190
|
- Add new `RSpec/Capybara/SpecificActions` cop. ([@ydah])
|
@@ -427,7 +500,7 @@
|
|
427
500
|
- Add config to `RSpec/VerifiedDoubles` to enforcement of verification on unnamed doubles. ([@BrentWheeldon])
|
428
501
|
- Fix `FactoryBot/AttributeDefinedStatically` not working when there is a non-symbol key. ([@vzvu3k6k])
|
429
502
|
- Fix false positive in `RSpec/ImplicitSubject` when `is_expected` is used inside `its()` block. ([@Darhazer])
|
430
|
-
- Add `single_statement_only` style to
|
503
|
+
- Add `single_statement_only` style to `RSpec/ImplicitSubject` as a more relaxed alternative to `single_line_only`. ([@Darhazer])
|
431
504
|
- Add `RSpec/UnspecifiedException` as a default cop to encourage more-specific `expect{}.to raise_error(ExceptionType)`, or `raise_exception` style handling of exceptions. ([@daveworth])
|
432
505
|
|
433
506
|
## 1.29.1 (2018-09-01)
|
@@ -462,14 +535,14 @@
|
|
462
535
|
|
463
536
|
## 1.26.0 (2018-06-06)
|
464
537
|
|
465
|
-
- Fix false positive in `RSpec/EmptyExampleGroup` cop when methods named like a RSpec method are used.
|
538
|
+
- Fix false positive in `RSpec/EmptyExampleGroup` cop when methods named like a RSpec method are used. ([@Darhazer])
|
466
539
|
- Fix `Capybara/FeatureMethods` not working when there is require before the spec. ([@Darhazer])
|
467
540
|
- Fix `RSpec/EmptyLineAfterFinalLet`: allow a comment to be placed after latest let, requiring empty line after the comment. ([@Darhazer])
|
468
541
|
- Add `RSpec/ReceiveCounts` cop to enforce usage of :once and :twice matchers. ([@Darhazer])
|
469
542
|
|
470
543
|
## 1.25.1 (2018-04-10)
|
471
544
|
|
472
|
-
- Fix false positive in `RSpec/Pending` cop when pending is used as a method name.
|
545
|
+
- Fix false positive in `RSpec/Pending` cop when pending is used as a method name. ([@Darhazer])
|
473
546
|
- Fix `FactoryBot/DynamicAttributeDefinedStatically` false positive when using symbol proc argument for a sequence. ([@tdeo])
|
474
547
|
|
475
548
|
## 1.25.0 (2018-04-07)
|
@@ -477,7 +550,7 @@
|
|
477
550
|
- Add `RSpec/SharedExamples` cop to enforce consistent usage of string to titleize shared examples. ([@anthony-robin])
|
478
551
|
- Add `RSpec/Be` cop to enforce passing argument to the generic `be` matcher. ([@Darhazer])
|
479
552
|
- Fix false positives in `StaticAttributeDefinedDynamically` and `ReturnFromStub` when a const is used in an array or hash. ([@Darhazer])
|
480
|
-
- Add `RSpec/Pending` cop to enforce no existing pending or skipped examples.
|
553
|
+
- Add `RSpec/Pending` cop to enforce no existing pending or skipped examples. This is disabled by default. ([@patrickomatic])
|
481
554
|
- Fix `RSpec/NestedGroups` cop support --auto-gen-config. ([@walf443])
|
482
555
|
- Fix false positives in `Capybara/FeatureMethods` when feature methods are used as property names in a factory. ([@Darhazer])
|
483
556
|
- Allow configuring enabled methods in `Capybara/FeatureMethods`. ([@Darhazer])
|
@@ -773,6 +846,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
773
846
|
[@aried3r]: https://github.com/aried3r
|
774
847
|
[@baberthal]: https://github.com/baberthal
|
775
848
|
[@backus]: https://github.com/backus
|
849
|
+
[@bcgraham]: https://github.com/bcgraham
|
776
850
|
[@biinari]: https://github.com/biinari
|
777
851
|
[@bmorrall]: https://github.com/bmorrall
|
778
852
|
[@bquorning]: https://github.com/bquorning
|
@@ -781,12 +855,14 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
781
855
|
[@cfabianski]: https://github.com/cfabianski
|
782
856
|
[@clupprich]: https://github.com/clupprich
|
783
857
|
[@composerinteralia]: https://github.com/composerinteralia
|
858
|
+
[@corydiamand]: https://github.com/corydiamand
|
784
859
|
[@darhazer]: https://github.com/Darhazer
|
785
860
|
[@daveworth]: https://github.com/daveworth
|
786
861
|
[@dduugg]: https://github.com/dduugg
|
787
862
|
[@deivid-rodriguez]: https://github.com/deivid-rodriguez
|
788
863
|
[@dgollahon]: https://github.com/dgollahon
|
789
864
|
[@dmitrytsepelev]: https://github.com/dmitrytsepelev
|
865
|
+
[@drcapulet]: https://github.com/drcapulet
|
790
866
|
[@drowze]: https://github.com/Drowze
|
791
867
|
[@dswij]: https://github.com/dswij
|
792
868
|
[@dvandersluis]: https://github.com/dvandersluis
|
@@ -799,6 +875,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
799
875
|
[@faucct]: https://github.com/faucct
|
800
876
|
[@foton]: https://github.com/foton
|
801
877
|
[@francois-ferrandis]: https://github.com/francois-ferrandis
|
878
|
+
[@franzliedke]: https://github.com/franzliedke
|
802
879
|
[@g-rath]: https://github.com/G-Rath
|
803
880
|
[@geniou]: https://github.com/geniou
|
804
881
|
[@gsamokovarov]: https://github.com/gsamokovarov
|
@@ -808,7 +885,9 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
808
885
|
[@ignaciovillaverde]: https://github.com/ignaciovillaverde
|
809
886
|
[@jaredbeck]: https://github.com/jaredbeck
|
810
887
|
[@jaredmoody]: https://github.com/jaredmoody
|
888
|
+
[@jdufresne]: https://github.com/jdufresne
|
811
889
|
[@jeffreyc]: https://github.com/jeffreyc
|
890
|
+
[@jessieay]: https://github.com/jessieay
|
812
891
|
[@jfragoulis]: https://github.com/jfragoulis
|
813
892
|
[@johnny-miyake]: https://github.com/johnny-miyake
|
814
893
|
[@jojos003]: https://github.com/jojos003
|
@@ -823,6 +902,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
823
902
|
[@lokhi]: https://github.com/lokhi
|
824
903
|
[@luke-hill]: https://github.com/luke-hill
|
825
904
|
[@m-yamashita01]: https://github.com/M-Yamashita01
|
905
|
+
[@marocchino]: https://github.com/marocchino
|
826
906
|
[@miguelfteixeira]: https://github.com/miguelfteixeira
|
827
907
|
[@mkenyon]: https://github.com/mkenyon
|
828
908
|
[@mkrawc]: https://github.com/mkrawc
|
@@ -830,6 +910,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
830
910
|
[@mockdeep]: https://github.com/mockdeep
|
831
911
|
[@mothonmars]: https://github.com/MothOnMars
|
832
912
|
[@mvz]: https://github.com/mvz
|
913
|
+
[@naveg]: https://github.com/naveg
|
833
914
|
[@nc-holodakg]: https://github.com/nc-holodakg
|
834
915
|
[@nevir]: https://github.com/nevir
|
835
916
|
[@ngouy]: https://github.com/ngouy
|
@@ -849,6 +930,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
849
930
|
[@rafix02]: https://github.com/Rafix02
|
850
931
|
[@redross]: https://github.com/redross
|
851
932
|
[@renanborgescampos]: https://github.com/renanborgescampos
|
933
|
+
[@robinaugh]: https://github.com/robinaugh
|
852
934
|
[@robotdana]: https://github.com/robotdana
|
853
935
|
[@rolfschmidt]: https://github.com/rolfschmidt
|
854
936
|
[@rrosenblum]: https://github.com/rrosenblum
|
@@ -859,13 +941,16 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
859
941
|
[@seanpdoyle]: https://github.com/seanpdoyle
|
860
942
|
[@sl4vr]: https://github.com/sl4vr
|
861
943
|
[@smcgivern]: https://github.com/smcgivern
|
944
|
+
[@splattael]: https://github.com/splattael
|
862
945
|
[@stephannv]: https://github.com/stephannv
|
946
|
+
[@swelther]: https://github.com/swelther
|
863
947
|
[@t3h2mas]: https://github.com/t3h2mas
|
864
948
|
[@tdeo]: https://github.com/tdeo
|
865
949
|
[@tejasbubane]: https://github.com/tejasbubane
|
866
950
|
[@telmofcosta]: https://github.com/telmofcosta
|
867
951
|
[@tietew]: https://github.com/Tietew
|
868
952
|
[@timrogers]: https://github.com/timrogers
|
953
|
+
[@tmaier]: https://github.com/tmaier
|
869
954
|
[@topalovic]: https://github.com/topalovic
|
870
955
|
[@twalpole]: https://github.com/twalpole
|
871
956
|
[@vzvu3k6k]: https://github.com/vzvu3k6k
|
data/README.md
CHANGED
data/config/default.yml
CHANGED
@@ -178,13 +178,14 @@ RSpec/BeNil:
|
|
178
178
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil
|
179
179
|
|
180
180
|
RSpec/BeforeAfterAll:
|
181
|
-
Description: Check that before/after(:all) isn't being used.
|
181
|
+
Description: Check that before/after(:all/:context) isn't being used.
|
182
182
|
Enabled: true
|
183
183
|
Exclude:
|
184
|
-
- spec/spec_helper.rb
|
185
|
-
- spec/rails_helper.rb
|
186
|
-
- spec/support/**/*.rb
|
184
|
+
- "**/spec/spec_helper.rb"
|
185
|
+
- "**/spec/rails_helper.rb"
|
186
|
+
- "**/spec/support/**/*.rb"
|
187
187
|
VersionAdded: '1.12'
|
188
|
+
VersionChanged: '2.23'
|
188
189
|
StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope
|
189
190
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
190
191
|
|
@@ -282,9 +283,10 @@ RSpec/DescribedClass:
|
|
282
283
|
SupportedStyles:
|
283
284
|
- described_class
|
284
285
|
- explicit
|
286
|
+
OnlyStaticConstants: true
|
285
287
|
SafeAutoCorrect: false
|
286
288
|
VersionAdded: '1.0'
|
287
|
-
VersionChanged: '
|
289
|
+
VersionChanged: '2.27'
|
288
290
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
|
289
291
|
|
290
292
|
RSpec/DescribedClassModuleWrapping:
|
@@ -358,6 +360,18 @@ RSpec/EmptyLineAfterSubject:
|
|
358
360
|
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
359
361
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
|
360
362
|
|
363
|
+
RSpec/EmptyMetadata:
|
364
|
+
Description: Avoid empty metadata hash.
|
365
|
+
Enabled: pending
|
366
|
+
VersionAdded: '2.24'
|
367
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyMetadata
|
368
|
+
|
369
|
+
RSpec/Eq:
|
370
|
+
Description: Use `eq` instead of `be ==` to compare objects.
|
371
|
+
Enabled: pending
|
372
|
+
VersionAdded: '2.24'
|
373
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Eq
|
374
|
+
|
361
375
|
RSpec/ExampleLength:
|
362
376
|
Description: Checks for long examples.
|
363
377
|
Enabled: true
|
@@ -404,8 +418,9 @@ RSpec/ExpectActual:
|
|
404
418
|
Description: Checks for `expect(...)` calls containing literal values.
|
405
419
|
Enabled: true
|
406
420
|
Exclude:
|
407
|
-
- spec/routing/**/*
|
421
|
+
- "**/spec/routing/**/*"
|
408
422
|
VersionAdded: '1.7'
|
423
|
+
VersionChanged: '2.23'
|
409
424
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
410
425
|
|
411
426
|
RSpec/ExpectChange:
|
@@ -444,7 +459,7 @@ RSpec/FilePath:
|
|
444
459
|
IgnoreMethods: false
|
445
460
|
SpecSuffixOnly: false
|
446
461
|
VersionAdded: '1.2'
|
447
|
-
VersionChanged: '
|
462
|
+
VersionChanged: '2.24'
|
448
463
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
|
449
464
|
|
450
465
|
RSpec/Focus:
|
@@ -513,8 +528,11 @@ RSpec/IndexedLet:
|
|
513
528
|
Description: Do not set up test data using indexes (e.g., `item_1`, `item_2`).
|
514
529
|
Enabled: pending
|
515
530
|
VersionAdded: '2.20'
|
531
|
+
VersionChanged: '2.23'
|
516
532
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IndexedLet
|
517
533
|
Max: 1
|
534
|
+
AllowedIdentifiers: []
|
535
|
+
AllowedPatterns: []
|
518
536
|
|
519
537
|
RSpec/InstanceSpy:
|
520
538
|
Description: Checks for `instance_double` used with `have_received`.
|
@@ -531,6 +549,13 @@ RSpec/InstanceVariable:
|
|
531
549
|
StyleGuide: https://rspec.rubystyle.guide/#instance-variables
|
532
550
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
533
551
|
|
552
|
+
RSpec/IsExpectedSpecify:
|
553
|
+
Description: Check for `specify` with `is_expected` and one-liner expectations.
|
554
|
+
Enabled: pending
|
555
|
+
VersionAdded: '2.27'
|
556
|
+
StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
|
557
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify
|
558
|
+
|
534
559
|
RSpec/ItBehavesLike:
|
535
560
|
Description: Checks that only one `it_behaves_like` style is used.
|
536
561
|
Enabled: true
|
@@ -608,6 +633,16 @@ RSpec/MessageSpies:
|
|
608
633
|
VersionAdded: '1.9'
|
609
634
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
610
635
|
|
636
|
+
RSpec/MetadataStyle:
|
637
|
+
Description: Use consistent metadata style.
|
638
|
+
Enabled: pending
|
639
|
+
EnforcedStyle: symbol
|
640
|
+
SupportedStyles:
|
641
|
+
- hash
|
642
|
+
- symbol
|
643
|
+
VersionAdded: '2.24'
|
644
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MetadataStyle
|
645
|
+
|
611
646
|
RSpec/MissingExampleGroupArgument:
|
612
647
|
Description: Checks that the first argument to an example group is not empty.
|
613
648
|
Enabled: true
|
@@ -725,6 +760,13 @@ RSpec/ReceiveCounts:
|
|
725
760
|
VersionAdded: '1.26'
|
726
761
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
|
727
762
|
|
763
|
+
RSpec/ReceiveMessages:
|
764
|
+
Description: Checks for multiple messages stubbed on the same object.
|
765
|
+
Enabled: pending
|
766
|
+
SafeAutoCorrect: false
|
767
|
+
VersionAdded: '2.23'
|
768
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveMessages
|
769
|
+
|
728
770
|
RSpec/ReceiveNever:
|
729
771
|
Description: Prefer `not_to receive(...)` over `receive(...).never`.
|
730
772
|
Enabled: true
|
@@ -737,6 +779,18 @@ RSpec/RedundantAround:
|
|
737
779
|
VersionAdded: '2.19'
|
738
780
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantAround
|
739
781
|
|
782
|
+
RSpec/RedundantPredicateMatcher:
|
783
|
+
Description: Checks for redundant predicate matcher.
|
784
|
+
Enabled: pending
|
785
|
+
VersionAdded: '2.26'
|
786
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantPredicateMatcher
|
787
|
+
|
788
|
+
RSpec/RemoveConst:
|
789
|
+
Description: Checks that `remove_const` is not used in specs.
|
790
|
+
Enabled: pending
|
791
|
+
VersionAdded: '2.26'
|
792
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RemoveConst
|
793
|
+
|
740
794
|
RSpec/RepeatedDescription:
|
741
795
|
Description: Check for repeated description strings in example groups.
|
742
796
|
Enabled: true
|
@@ -767,6 +821,12 @@ RSpec/RepeatedIncludeExample:
|
|
767
821
|
VersionAdded: '1.44'
|
768
822
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
|
769
823
|
|
824
|
+
RSpec/RepeatedSubjectCall:
|
825
|
+
Description: Checks for repeated calls to subject missing that it is memoized.
|
826
|
+
Enabled: pending
|
827
|
+
VersionAdded: '2.27'
|
828
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedSubjectCall
|
829
|
+
|
770
830
|
RSpec/ReturnFromStub:
|
771
831
|
Description: Checks for consistent style of stub's return setting.
|
772
832
|
Enabled: true
|
@@ -798,9 +858,14 @@ RSpec/SharedContext:
|
|
798
858
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
|
799
859
|
|
800
860
|
RSpec/SharedExamples:
|
801
|
-
Description:
|
861
|
+
Description: Checks for consistent style for shared example names.
|
802
862
|
Enabled: true
|
863
|
+
EnforcedStyle: string
|
864
|
+
SupportedStyles:
|
865
|
+
- string
|
866
|
+
- symbol
|
803
867
|
VersionAdded: '1.25'
|
868
|
+
VersionChanged: '2.26'
|
804
869
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
|
805
870
|
|
806
871
|
RSpec/SingleArgumentMessageChain:
|
@@ -822,6 +887,31 @@ RSpec/SortMetadata:
|
|
822
887
|
VersionAdded: '2.14'
|
823
888
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata
|
824
889
|
|
890
|
+
RSpec/SpecFilePathFormat:
|
891
|
+
Description: Checks that spec file paths are consistent and well-formed.
|
892
|
+
Enabled: pending
|
893
|
+
Include:
|
894
|
+
- "**/*_spec.rb"
|
895
|
+
Exclude:
|
896
|
+
- "**/spec/routing/**/*"
|
897
|
+
CustomTransform:
|
898
|
+
RuboCop: rubocop
|
899
|
+
RSpec: rspec
|
900
|
+
IgnoreMethods: false
|
901
|
+
IgnoreMetadata:
|
902
|
+
type: routing
|
903
|
+
VersionAdded: '2.24'
|
904
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SpecFilePathFormat
|
905
|
+
|
906
|
+
RSpec/SpecFilePathSuffix:
|
907
|
+
Description: Checks that spec file paths suffix are consistent and well-formed.
|
908
|
+
Enabled: pending
|
909
|
+
VersionAdded: '2.24'
|
910
|
+
Include:
|
911
|
+
- "**/*_spec*rb*"
|
912
|
+
- "**/spec/**/*"
|
913
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SpecFilePathSuffix
|
914
|
+
|
825
915
|
RSpec/StubbedMock:
|
826
916
|
Description: Checks that message expectations do not have a configured response.
|
827
917
|
Enabled: true
|
@@ -974,11 +1064,11 @@ RSpec/FactoryBot/AttributeDefinedStatically:
|
|
974
1064
|
Description: Always declare attribute values as blocks.
|
975
1065
|
Enabled: true
|
976
1066
|
Include:
|
977
|
-
- spec/factories.rb
|
978
|
-
- spec/factories/**/*.rb
|
979
|
-
- features/support/factories/**/*.rb
|
1067
|
+
- "**/spec/factories.rb"
|
1068
|
+
- "**/spec/factories/**/*.rb"
|
1069
|
+
- "**/features/support/factories/**/*.rb"
|
980
1070
|
VersionAdded: '1.28'
|
981
|
-
VersionChanged: '2.
|
1071
|
+
VersionChanged: '2.23'
|
982
1072
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
983
1073
|
|
984
1074
|
RSpec/FactoryBot/ConsistentParenthesesStyle:
|
@@ -997,26 +1087,26 @@ RSpec/FactoryBot/CreateList:
|
|
997
1087
|
Include:
|
998
1088
|
- "**/*_spec.rb"
|
999
1089
|
- "**/spec/**/*"
|
1000
|
-
- spec/factories.rb
|
1001
|
-
- spec/factories/**/*.rb
|
1002
|
-
- features/support/factories/**/*.rb
|
1090
|
+
- "**/spec/factories.rb"
|
1091
|
+
- "**/spec/factories/**/*.rb"
|
1092
|
+
- "**/features/support/factories/**/*.rb"
|
1003
1093
|
EnforcedStyle: create_list
|
1004
1094
|
SupportedStyles:
|
1005
1095
|
- create_list
|
1006
1096
|
- n_times
|
1007
1097
|
VersionAdded: '1.25'
|
1008
|
-
VersionChanged: '2.
|
1098
|
+
VersionChanged: '2.23'
|
1009
1099
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
1010
1100
|
|
1011
1101
|
RSpec/FactoryBot/FactoryClassName:
|
1012
1102
|
Description: Use string value when setting the class attribute explicitly.
|
1013
1103
|
Enabled: true
|
1014
1104
|
Include:
|
1015
|
-
- spec/factories.rb
|
1016
|
-
- spec/factories/**/*.rb
|
1017
|
-
- features/support/factories/**/*.rb
|
1105
|
+
- "**/spec/factories.rb"
|
1106
|
+
- "**/spec/factories/**/*.rb"
|
1107
|
+
- "**/features/support/factories/**/*.rb"
|
1018
1108
|
VersionAdded: '1.37'
|
1019
|
-
VersionChanged: '2.
|
1109
|
+
VersionChanged: '2.23'
|
1020
1110
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
1021
1111
|
|
1022
1112
|
RSpec/FactoryBot/FactoryNameStyle:
|
@@ -1050,8 +1140,12 @@ RSpec/Rails/AvoidSetupHook:
|
|
1050
1140
|
RSpec/Rails/HaveHttpStatus:
|
1051
1141
|
Description: Checks that tests use `have_http_status` instead of equality matchers.
|
1052
1142
|
Enabled: pending
|
1143
|
+
ResponseMethods:
|
1144
|
+
- response
|
1145
|
+
- last_response
|
1053
1146
|
SafeAutoCorrect: false
|
1054
1147
|
VersionAdded: '2.12'
|
1148
|
+
VersionChanged: '2.27'
|
1055
1149
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
|
1056
1150
|
|
1057
1151
|
RSpec/Rails/HttpStatus:
|
@@ -1090,11 +1184,22 @@ RSpec/Rails/InferredSpecType:
|
|
1090
1184
|
views: view
|
1091
1185
|
|
1092
1186
|
RSpec/Rails/MinitestAssertions:
|
1093
|
-
Description: Check if using Minitest matchers.
|
1187
|
+
Description: Check if using Minitest-like matchers.
|
1094
1188
|
Enabled: pending
|
1095
1189
|
VersionAdded: '2.17'
|
1096
1190
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions
|
1097
1191
|
|
1192
|
+
RSpec/Rails/NegationBeValid:
|
1193
|
+
Description: Enforces use of `be_invalid` or `not_to` for negated be_valid.
|
1194
|
+
Safe: false
|
1195
|
+
EnforcedStyle: not_to
|
1196
|
+
SupportedStyles:
|
1197
|
+
- not_to
|
1198
|
+
- be_invalid
|
1199
|
+
Enabled: pending
|
1200
|
+
VersionAdded: '2.23'
|
1201
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/NegationBeValid
|
1202
|
+
|
1098
1203
|
RSpec/Rails/TravelAround:
|
1099
1204
|
Description: Prefer to travel in `before` rather than `around`.
|
1100
1205
|
Enabled: pending
|
@@ -32,17 +32,17 @@ module RuboCop
|
|
32
32
|
'or `%<arg>s.run`.'
|
33
33
|
|
34
34
|
# @!method hook_block(node)
|
35
|
-
def_node_matcher :hook_block,
|
35
|
+
def_node_matcher :hook_block, <<~PATTERN
|
36
36
|
(block (send nil? :around sym ?) (args $...) ...)
|
37
37
|
PATTERN
|
38
38
|
|
39
39
|
# @!method hook_numblock(node)
|
40
|
-
def_node_matcher :hook_numblock,
|
40
|
+
def_node_matcher :hook_numblock, <<~PATTERN
|
41
41
|
(numblock (send nil? :around sym ?) ...)
|
42
42
|
PATTERN
|
43
43
|
|
44
44
|
# @!method find_arg_usage(node)
|
45
|
-
def_node_search :find_arg_usage,
|
45
|
+
def_node_search :find_arg_usage, <<~PATTERN
|
46
46
|
{(send $... {:call :run}) (send _ _ $...) (yield $...) (block-pass $...)}
|
47
47
|
PATTERN
|
48
48
|
|
data/lib/rubocop/cop/rspec/be.rb
CHANGED
@@ -44,7 +44,7 @@ module RuboCop
|
|
44
44
|
RESTRICT_ON_SEND = %i[to].freeze
|
45
45
|
|
46
46
|
# @!method eql_type_with_identity(node)
|
47
|
-
def_node_matcher :eql_type_with_identity,
|
47
|
+
def_node_matcher :eql_type_with_identity, <<~PATTERN
|
48
48
|
(send _ :to $(send nil? :eql {true false int float sym nil}))
|
49
49
|
PATTERN
|
50
50
|
|
@@ -33,12 +33,12 @@ module RuboCop
|
|
33
33
|
RESTRICT_ON_SEND = %i[be be_nil].freeze
|
34
34
|
|
35
35
|
# @!method be_nil_matcher?(node)
|
36
|
-
def_node_matcher :be_nil_matcher?,
|
36
|
+
def_node_matcher :be_nil_matcher?, <<~PATTERN
|
37
37
|
(send nil? :be_nil)
|
38
38
|
PATTERN
|
39
39
|
|
40
40
|
# @!method nil_value_expectation?(node)
|
41
|
-
def_node_matcher :nil_value_expectation?,
|
41
|
+
def_node_matcher :nil_value_expectation?, <<~PATTERN
|
42
42
|
(send nil? :be nil)
|
43
43
|
PATTERN
|
44
44
|
|
@@ -3,22 +3,16 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module RSpec
|
6
|
-
# Check that before/after(:all) isn't being used.
|
6
|
+
# Check that before/after(:all/:context) isn't being used.
|
7
7
|
#
|
8
8
|
# @example
|
9
|
-
# # bad
|
10
|
-
# #
|
11
|
-
# # Faster but risk of state leaking between examples
|
12
|
-
# #
|
9
|
+
# # bad - Faster but risk of state leaking between examples
|
13
10
|
# describe MyClass do
|
14
11
|
# before(:all) { Widget.create }
|
15
|
-
# after(:
|
12
|
+
# after(:context) { Widget.delete_all }
|
16
13
|
# end
|
17
14
|
#
|
18
|
-
# # good
|
19
|
-
# #
|
20
|
-
# # Slower but examples are properly isolated
|
21
|
-
# #
|
15
|
+
# # good - Slower but examples are properly isolated
|
22
16
|
# describe MyClass do
|
23
17
|
# before(:each) { Widget.create }
|
24
18
|
# after(:each) { Widget.delete_all }
|
@@ -30,11 +24,11 @@ module RuboCop
|
|
30
24
|
'`use_transactional_fixtures` is enabled, then records created ' \
|
31
25
|
'in `%<hook>s` are not automatically rolled back.'
|
32
26
|
|
33
|
-
RESTRICT_ON_SEND =
|
27
|
+
RESTRICT_ON_SEND = Set[:before, :after].freeze
|
34
28
|
|
35
29
|
# @!method before_or_after_all(node)
|
36
|
-
def_node_matcher :before_or_after_all,
|
37
|
-
$(send _
|
30
|
+
def_node_matcher :before_or_after_all, <<~PATTERN
|
31
|
+
$(send _ RESTRICT_ON_SEND (sym {:all :context}))
|
38
32
|
PATTERN
|
39
33
|
|
40
34
|
def on_send(node)
|