rubocop-rspec 2.12.1 → 2.13.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 +114 -86
- data/config/default.yml +44 -6
- data/config/obsoletion.yml +14 -0
- data/lib/rubocop/cop/rspec/align_left_let_brace.rb +8 -9
- data/lib/rubocop/cop/rspec/align_right_let_brace.rb +8 -9
- data/lib/rubocop/cop/rspec/any_instance.rb +1 -0
- data/lib/rubocop/cop/rspec/around_block.rb +26 -3
- data/lib/rubocop/cop/rspec/be.rb +0 -1
- data/lib/rubocop/cop/rspec/be_eq.rb +0 -1
- data/lib/rubocop/cop/rspec/be_eql.rb +0 -1
- data/lib/rubocop/cop/rspec/before_after_all.rb +1 -0
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +9 -3
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +2 -1
- data/lib/rubocop/cop/rspec/capybara/specific_finders.rb +86 -0
- data/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +91 -10
- data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +0 -1
- data/lib/rubocop/cop/rspec/change_by_zero.rb +60 -5
- data/lib/rubocop/cop/rspec/class_check.rb +101 -0
- data/lib/rubocop/cop/rspec/context_method.rb +2 -1
- data/lib/rubocop/cop/rspec/context_wording.rb +49 -18
- data/lib/rubocop/cop/rspec/describe_class.rb +1 -1
- data/lib/rubocop/cop/rspec/describe_method.rb +1 -0
- data/lib/rubocop/cop/rspec/described_class.rb +4 -14
- data/lib/rubocop/cop/rspec/dialect.rb +1 -0
- data/lib/rubocop/cop/rspec/empty_example_group.rb +19 -4
- data/lib/rubocop/cop/rspec/empty_hook.rb +2 -1
- data/lib/rubocop/cop/rspec/empty_line_after_example.rb +4 -9
- data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +2 -1
- data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +32 -2
- data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +2 -1
- data/lib/rubocop/cop/rspec/example_length.rb +2 -1
- data/lib/rubocop/cop/rspec/example_without_description.rb +2 -1
- data/lib/rubocop/cop/rspec/example_wording.rb +2 -1
- data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +1 -0
- data/lib/rubocop/cop/rspec/expect_actual.rb +3 -0
- data/lib/rubocop/cop/rspec/expect_change.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_in_hook.rb +4 -1
- data/lib/rubocop/cop/rspec/expect_output.rb +1 -0
- data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +2 -1
- data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +26 -12
- data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +1 -0
- data/lib/rubocop/cop/rspec/file_path.rb +6 -3
- data/lib/rubocop/cop/rspec/focus.rb +18 -0
- data/lib/rubocop/cop/rspec/hook_argument.rb +7 -2
- data/lib/rubocop/cop/rspec/hooks_before_examples.rb +10 -9
- data/lib/rubocop/cop/rspec/identical_equality_assertion.rb +0 -1
- data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +1 -0
- data/lib/rubocop/cop/rspec/implicit_expect.rb +0 -2
- data/lib/rubocop/cop/rspec/instance_spy.rb +1 -1
- data/lib/rubocop/cop/rspec/instance_variable.rb +0 -1
- data/lib/rubocop/cop/rspec/it_behaves_like.rb +1 -0
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +16 -0
- data/lib/rubocop/cop/rspec/leading_subject.rb +15 -15
- data/lib/rubocop/cop/rspec/let_before_examples.rb +7 -8
- data/lib/rubocop/cop/rspec/let_setup.rb +4 -4
- data/lib/rubocop/cop/rspec/message_chain.rb +1 -1
- data/lib/rubocop/cop/rspec/missing_example_group_argument.rb +2 -1
- data/lib/rubocop/cop/rspec/mixin/css_selector.rb +99 -0
- data/lib/rubocop/cop/rspec/mixin/namespace.rb +23 -0
- data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -0
- data/lib/rubocop/cop/rspec/multiple_expectations.rb +1 -5
- data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +1 -3
- data/lib/rubocop/cop/rspec/multiple_subjects.rb +17 -2
- data/lib/rubocop/cop/rspec/named_subject.rb +2 -1
- data/lib/rubocop/cop/rspec/nested_groups.rb +45 -25
- data/lib/rubocop/cop/rspec/no_expectation_example.rb +64 -0
- data/lib/rubocop/cop/rspec/not_to_not.rb +1 -2
- data/lib/rubocop/cop/rspec/overwriting_setup.rb +2 -1
- data/lib/rubocop/cop/rspec/pending.rb +1 -0
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +2 -1
- data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +1 -2
- data/lib/rubocop/cop/rspec/receive_counts.rb +14 -15
- data/lib/rubocop/cop/rspec/receive_never.rb +4 -5
- data/lib/rubocop/cop/rspec/repeated_description.rb +25 -26
- data/lib/rubocop/cop/rspec/repeated_example.rb +1 -1
- data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +28 -29
- data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +28 -29
- data/lib/rubocop/cop/rspec/repeated_include_example.rb +32 -33
- data/lib/rubocop/cop/rspec/return_from_stub.rb +1 -1
- data/lib/rubocop/cop/rspec/scattered_let.rb +1 -5
- data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
- data/lib/rubocop/cop/rspec/shared_context.rb +1 -1
- data/lib/rubocop/cop/rspec/stubbed_mock.rb +0 -1
- data/lib/rubocop/cop/rspec/subject_declaration.rb +0 -1
- data/lib/rubocop/cop/rspec/subject_stub.rb +2 -2
- data/lib/rubocop/cop/rspec/unspecified_exception.rb +15 -15
- data/lib/rubocop/cop/rspec/variable_definition.rb +1 -0
- data/lib/rubocop/cop/rspec/variable_name.rb +6 -7
- data/lib/rubocop/cop/rspec/verified_doubles.rb +1 -0
- data/lib/rubocop/cop/rspec/void_expect.rb +2 -1
- data/lib/rubocop/cop/rspec/yield.rb +2 -1
- data/lib/rubocop/cop/rspec_cops.rb +3 -0
- data/lib/rubocop/rspec/config_formatter.rb +14 -3
- data/lib/rubocop/rspec/inject.rb +1 -3
- data/lib/rubocop/rspec/language/node_pattern.rb +4 -0
- data/lib/rubocop/rspec/language.rb +6 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop/rspec/wording.rb +2 -2
- data/lib/rubocop/rspec.rb +14 -0
- data/lib/rubocop-rspec.rb +3 -0
- metadata +11 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beb4503a6d6d420e50748e9fd6c679a2968888d783293c33da2dbaf6d7a9fc3f
|
4
|
+
data.tar.gz: 4dff5e6a61c80d1acc943169efdb65a24fa5dd05654bf758c4f6b291aedad63c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7937a46e61db588b4b9354ec362af79585526e7d95a7bc735435ace552b44e354f32e8f10310460059b71870a1caf8617414edd663cf8b50e9f13405977123a4
|
7
|
+
data.tar.gz: 7c4a57c7635e827717d10f253233837e7b9c11c5769fd4d9aab7c7c110d808f83c6099663684237c499432f606891b7a8aa9142c302e09ad5e73391b70f29a8e
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,33 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 2.13.1 (2022-09-12)
|
6
|
+
|
7
|
+
* Include config/obsoletion.yml in the gemspec. ([@hosamaly][])
|
8
|
+
|
9
|
+
## 2.13.0 (2022-09-12)
|
10
|
+
|
11
|
+
* Fix `RSpec/FilePath` cop missing mismatched expanded namespace. ([@sl4vr][])
|
12
|
+
* Add new `AllowConsecutiveOneLiners` (default true) option for `Rspec/EmptyLineAfterHook` cop. ([@ngouy][])
|
13
|
+
* Add autocorrect support for `RSpec/EmptyExampleGroup`. ([@r7kamura][])
|
14
|
+
* Fix `RSpec/ChangeByZero` with compound expressions using `&` or `|` operators. ([@BrianHawley][])
|
15
|
+
* Add `RSpec/NoExpectationExample`. ([@r7kamura][])
|
16
|
+
* Add some expectation methods to default configuration. ([@r7kamura][])
|
17
|
+
* Fix a false positive for `RSpec/Capybara/SpecificMatcher`. ([@ydah][])
|
18
|
+
* Fix a false negative for `RSpec/Capybara/SpecificMatcher` for `have_field`. ([@ydah][])
|
19
|
+
* Fix a false positive for `RSpec/Capybara/SpecificMatcher` when may not have a `href` by `have_link`. ([@ydah][])
|
20
|
+
* Add `NegatedMatcher` configuration option to `RSpec/ChangeByZero`. ([@ydah][])
|
21
|
+
* Add new `RSpec/Capybara/SpecificFinders` cop. ([@ydah][])
|
22
|
+
* Add support for numblocks to `RSpec/AroundBlock`, `RSpec/EmptyLineAfterHook`, `RSpec/ExpectInHook`, `RSpec/HookArgument`, `RSpec/HooksBeforeExamples`, `RSpec/IteratedExpectation`, and `RSpec/NoExpectationExample`. ([@ydah][])
|
23
|
+
* Fix incorrect documentation URLs when using `rubocop --show-docs-url`. ([@r7kamura][])
|
24
|
+
* Add `AllowedGroups` configuration option to `RSpec/NestedGroups`. ([@ydah][])
|
25
|
+
* Deprecate `IgnoredPatterns` option in favor of the `AllowedPatterns` options. ([@ydah][])
|
26
|
+
* Add `AllowedPatterns` configuration option to `RSpec/ContextWording`. ([@ydah][])
|
27
|
+
* Add `RSpec/ClassCheck` cop. ([@r7kamura][])
|
28
|
+
* Fix a false positive for `RSpec/Capybara/SpecificMatcher` when pseudo-classes. ([@ydah][])
|
29
|
+
* Fix a false negative for `RSpec/SubjectStub` when the subject is declared with the `subject!` method and called by name. ([@eikes][])
|
30
|
+
* Support `Array.new(n)` on `RSpec/FactoryBot/CreateList` cop. ([@r7kamura][])
|
31
|
+
|
5
32
|
## 2.12.1 (2022-07-03)
|
6
33
|
|
7
34
|
* Fix a false positive for `RSpec/Capybara/SpecificMatcher`. ([@ydah][])
|
@@ -603,114 +630,115 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
603
630
|
* Split `UnitSpecNaming` cop into `RSpecDescribeClass`, `RSpecDescribeMethod` and `RSpecFileName` and enabled them all by default. ([@geniou][])
|
604
631
|
* Add `RSpecExampleWording` cop to prevent to use of should at the beginning of the spec description. ([@geniou][])
|
605
632
|
* Fix `RSpecFileName` cop for non-class specs. ([@geniou][])
|
606
|
-
* Adapt `RSpecFileName` cop to
|
633
|
+
* Adapt `RSpecFileName` cop to common naming convention and skip spec with multiple top level describes. ([@geniou][])
|
607
634
|
* Add `RSpecMultipleDescribes` cop to check for multiple top level describes. ([@geniou][])
|
608
635
|
* Add `RSpecDescribedClass` to promote the use of `described_class`. ([@geniou][])
|
609
636
|
* Add `RSpecInstanceVariable` cop to check for the usage of instance variables. ([@geniou][])
|
610
637
|
|
611
|
-
<!-- Contributors -->
|
638
|
+
<!-- Contributors (alphabetically) -->
|
612
639
|
|
640
|
+
[@abrom]: https://github.com/abrom
|
641
|
+
[@ahukkanen]: https://github.com/ahukkanen
|
642
|
+
[@akiomik]: https://github.com/akiomik
|
643
|
+
[@AlexWayfer]: https://github.com/AlexWayfer
|
644
|
+
[@andrykonchin]: https://github.com/andrykonchin
|
613
645
|
[@andyw8]: https://github.com/andyw8
|
646
|
+
[@anthony-robin]: https://github.com/anthony-robin
|
647
|
+
[@aried3r]: https://github.com/aried3r
|
648
|
+
[@baberthal]: https://github.com/baberthal
|
614
649
|
[@backus]: https://github.com/backus
|
650
|
+
[@biinari]: https://github.com/biinari
|
651
|
+
[@bmorrall]: https://github.com/bmorrall
|
615
652
|
[@bquorning]: https://github.com/bquorning
|
653
|
+
[@BrentWheeldon]: https://github.com/BrentWheeldon
|
654
|
+
[@BrianHawley]: https://github.com/BrianHawley
|
655
|
+
[@cfabianski]: https://github.com/cfabianski
|
656
|
+
[@clupprich]: https://github.com/clupprich
|
657
|
+
[@composerinteralia]: https://github.com/composerinteralia
|
658
|
+
[@Darhazer]: https://github.com/Darhazer
|
659
|
+
[@daveworth]: https://github.com/daveworth
|
660
|
+
[@dduugg]: https://github.com/dduugg
|
616
661
|
[@deivid-rodriguez]: https://github.com/deivid-rodriguez
|
662
|
+
[@dgollahon]: https://github.com/dgollahon
|
663
|
+
[@Drowze]: https://github.com/Drowze
|
664
|
+
[@dswij]: https://github.com/dswij
|
665
|
+
[@dvandersluis]: https://github.com/dvandersluis
|
666
|
+
[@edgibbs]: https://github.com/edgibbs
|
667
|
+
[@eikes]: https://github.com/eikes
|
668
|
+
[@eitoball]: https://github.com/eitoball
|
669
|
+
[@elebow]: https://github.com/elebow
|
670
|
+
[@EliseFitz15]: https://github.com/EliseFitz15
|
671
|
+
[@elliterate]: https://github.com/elliterate
|
672
|
+
[@foton]: https://github.com/foton
|
673
|
+
[@francois-ferrandis]: https://github.com/francois-ferrandis
|
674
|
+
[@G-Rath]: https://github.com/G-Rath
|
617
675
|
[@geniou]: https://github.com/geniou
|
676
|
+
[@gsamokovarov]: https://github.com/gsamokovarov
|
677
|
+
[@harry-graham]: https://github.com/harry-graham
|
678
|
+
[@harrylewis]: https://github.com/harrylewis
|
679
|
+
[@hosamaly]: https://github.com/hosamaly
|
618
680
|
[@jaredbeck]: https://github.com/jaredbeck
|
619
|
-
[@jawshooah]: https://github.com/jawshooah
|
620
|
-
[@nevir]: https://github.com/nevir
|
621
|
-
[@nijikon]: https://github.com/nijikon
|
622
|
-
[@pstengel]: https://github.com/pstengel
|
623
|
-
[@miguelfteixeira]: https://github.com/miguelfteixeira
|
624
|
-
[@mlarraz]: https://github.com/mlarraz
|
625
|
-
[@renanborgescampos]: https://github.com/renanborgescampos
|
626
681
|
[@jaredmoody]: https://github.com/jaredmoody
|
627
|
-
[@baberthal]: https://github.com/baberthal
|
628
682
|
[@jeffreyc]: https://github.com/jeffreyc
|
629
|
-
[@
|
630
|
-
[@
|
631
|
-
[@Darhazer]: https://github.com/Darhazer
|
632
|
-
[@redross]: https://github.com/redross
|
633
|
-
[@cfabianski]: https://github.com/cfabianski
|
634
|
-
[@dgollahon]: https://github.com/dgollahon
|
635
|
-
[@rspeicher]: https://github.com/rspeicher
|
636
|
-
[@jonatas]: https://github.com/jonatas
|
637
|
-
[@pocke]: https://github.com/pocke
|
638
|
-
[@bmorrall]: https://github.com/bmorrall
|
639
|
-
[@zverok]: https://github.com/zverok
|
640
|
-
[@timrogers]: https://github.com/timrogers
|
641
|
-
[@yevhene]: https://github.com/yevhene
|
642
|
-
[@walf443]: https://github.com/walf443
|
643
|
-
[@pirj]: https://github.com/pirj
|
644
|
-
[@telmofcosta]: https://github.com/telmofcosta
|
645
|
-
[@EliseFitz15]: https://github.com/EliseFitz15
|
646
|
-
[@anthony-robin]: https://github.com/anthony-robin
|
683
|
+
[@jfragoulis]: https://github.com/jfragoulis
|
684
|
+
[@johnny-miyake]: https://github.com/johnny-miyake
|
647
685
|
[@jojos003]: https://github.com/jojos003
|
648
|
-
[@
|
649
|
-
[@
|
650
|
-
[@
|
651
|
-
[@
|
652
|
-
[@
|
653
|
-
[@
|
654
|
-
[@
|
655
|
-
[@
|
656
|
-
[@
|
657
|
-
[@
|
686
|
+
[@jonatas]: https://github.com/jonatas
|
687
|
+
[@jtannas]: https://github.com/jtannas
|
688
|
+
[@kellysutton]: https://github.com/kellysutton
|
689
|
+
[@koic]: https://github.com/koic
|
690
|
+
[@lazycoder9]: https://github.com/lazycoder9
|
691
|
+
[@leoarnold]: https://github.com/leoarnold
|
692
|
+
[@lokhi]: https://github.com/lokhi
|
693
|
+
[@luke-hill]: https://github.com/luke-hill
|
694
|
+
[@M-Yamashita01]: https://github.com/M-Yamashita01
|
695
|
+
[@miguelfteixeira]: https://github.com/miguelfteixeira
|
658
696
|
[@mkenyon]: https://github.com/mkenyon
|
659
|
-
[@
|
660
|
-
[@
|
661
|
-
[@
|
697
|
+
[@mkrawc]: https://github.com/mkrawc
|
698
|
+
[@mlarraz]: https://github.com/mlarraz
|
699
|
+
[@mockdeep]: https://github.com/mockdeep
|
700
|
+
[@MothOnMars]: https://github.com/MothOnMars
|
662
701
|
[@nc-holodakg]: https://github.com/nc-holodakg
|
663
|
-
[@
|
702
|
+
[@nevir]: https://github.com/nevir
|
703
|
+
[@ngouy]: https://github.com/ngouy
|
664
704
|
[@nickcampbell18]: https://github.com/nickcampbell18
|
705
|
+
[@nijikon]: https://github.com/nijikon
|
706
|
+
[@onk]: https://github.com/onk
|
707
|
+
[@onumis]: https://github.com/onumis
|
708
|
+
[@oshiro3]: https://github.com/oshiro3
|
709
|
+
[@patrickomatic]: https://github.com/patrickomatic
|
710
|
+
[@paydaylight]: https://github.com/paydaylight
|
711
|
+
[@PhilCoggins]: https://github.com/PhilCoggins
|
712
|
+
[@pirj]: https://github.com/pirj
|
713
|
+
[@pocke]: https://github.com/pocke
|
714
|
+
[@pstengel]: https://github.com/pstengel
|
665
715
|
[@QQism]: https://github.com/QQism
|
666
|
-
[@
|
667
|
-
[@
|
668
|
-
[@
|
669
|
-
[@
|
670
|
-
[@dduugg]: https://github.com/dduugg
|
671
|
-
[@lazycoder9]: https://github.com/lazycoder9
|
672
|
-
[@elebow]: https://github.com/elebow
|
673
|
-
[@eitoball]: https://github.com/eitoball
|
674
|
-
[@aried3r]: https://github.com/aried3r
|
675
|
-
[@AlexWayfer]: https://github.com/AlexWayfer
|
676
|
-
[@tejasbubane]: https://github.com/tejasbubane
|
677
|
-
[@twalpole]: https://github.com/twalpole
|
678
|
-
[@zdennis]: https://github.com/zdennis
|
716
|
+
[@r7kamura]: https://github.com/r7kamura
|
717
|
+
[@Rafix02]: https://github.com/Rafix02
|
718
|
+
[@redross]: https://github.com/redross
|
719
|
+
[@renanborgescampos]: https://github.com/renanborgescampos
|
679
720
|
[@robotdana]: https://github.com/robotdana
|
680
721
|
[@rolfschmidt]: https://github.com/rolfschmidt
|
681
|
-
[@
|
682
|
-
[@
|
683
|
-
[@
|
684
|
-
[@
|
685
|
-
[@
|
686
|
-
[@biinari]: https://github.com/biinari
|
687
|
-
[@koic]: https://github.com/koic
|
688
|
-
[@Rafix02]: https://github.com/Rafix02
|
689
|
-
[@PhilCoggins]: https://github.com/PhilCoggins
|
722
|
+
[@rrosenblum]: https://github.com/rrosenblum
|
723
|
+
[@rspeicher]: https://github.com/rspeicher
|
724
|
+
[@RST-J]: https://github.com/RST-J
|
725
|
+
[@schmijos]: https://github.com/schmijos
|
726
|
+
[@seanpdoyle]: https://github.com/seanpdoyle
|
690
727
|
[@sl4vr]: https://github.com/sl4vr
|
691
|
-
[@ahukkanen]: https://github.com/ahukkanen
|
692
|
-
[@dvandersluis]: https://github.com/dvandersluis
|
693
|
-
[@hosamaly]: https://github.com/hosamaly
|
694
728
|
[@stephannv]: https://github.com/stephannv
|
729
|
+
[@t3h2mas]: https://github.com/t3h2mas
|
730
|
+
[@tdeo]: https://github.com/tdeo
|
731
|
+
[@tejasbubane]: https://github.com/tejasbubane
|
732
|
+
[@telmofcosta]: https://github.com/telmofcosta
|
695
733
|
[@Tietew]: https://github.com/Tietew
|
696
|
-
[@
|
697
|
-
[@paydaylight]: https://github.com/paydaylight
|
734
|
+
[@timrogers]: https://github.com/timrogers
|
698
735
|
[@topalovic]: https://github.com/topalovic
|
699
|
-
[@
|
700
|
-
[@
|
701
|
-
[@
|
702
|
-
[@
|
703
|
-
[@francois-ferrandis]: https://github.com/francois-ferrandis
|
704
|
-
[@r7kamura]: https://github.com/r7kamura
|
705
|
-
[@leoarnold]: https://github.com/leoarnold
|
706
|
-
[@harry-graham]: https://github.com/harry-graham
|
707
|
-
[@oshiro3]: https://github.com/oshiro3
|
736
|
+
[@twalpole]: https://github.com/twalpole
|
737
|
+
[@vzvu3k6k]: https://github.com/vzvu3k6k
|
738
|
+
[@walf443]: https://github.com/walf443
|
739
|
+
[@ybiquitous]: https://github.com/ybiquitous
|
708
740
|
[@ydah]: https://github.com/ydah
|
709
|
-
[@
|
710
|
-
[@
|
711
|
-
[@
|
712
|
-
[@
|
713
|
-
[@ngouy]: https://github.com/ngouy
|
714
|
-
[@edgibbs]: https://github.com/edgibbs
|
715
|
-
[@Drowze]: https://github.com/Drowze
|
716
|
-
[@akiomik]: https://github.com/akiomik
|
741
|
+
[@yevhene]: https://github.com/yevhene
|
742
|
+
[@ypresto]: https://github.com/ypresto
|
743
|
+
[@zdennis]: https://github.com/zdennis
|
744
|
+
[@zverok]: https://github.com/zverok
|
data/config/default.yml
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
RSpec:
|
3
3
|
Enabled: true
|
4
4
|
StyleGuideBaseURL: https://rspec.rubystyle.guide
|
5
|
+
DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec
|
5
6
|
Include: &1
|
6
7
|
- "**/*_spec.rb"
|
7
8
|
- "**/spec/**/*"
|
@@ -61,9 +62,14 @@ RSpec:
|
|
61
62
|
Pending:
|
62
63
|
- pending
|
63
64
|
Expectations:
|
65
|
+
- are_expected
|
64
66
|
- expect
|
65
|
-
- is_expected
|
66
67
|
- expect_any_instance_of
|
68
|
+
- is_expected
|
69
|
+
- should
|
70
|
+
- should_not
|
71
|
+
- should_not_receive
|
72
|
+
- should_receive
|
67
73
|
Helpers:
|
68
74
|
- let
|
69
75
|
- let!
|
@@ -187,8 +193,21 @@ RSpec/BeforeAfterAll:
|
|
187
193
|
RSpec/ChangeByZero:
|
188
194
|
Description: Prefer negated matchers over `to change.by(0)`.
|
189
195
|
Enabled: pending
|
190
|
-
VersionAdded: 2.11
|
196
|
+
VersionAdded: '2.11'
|
197
|
+
VersionChanged: '2.13'
|
191
198
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero
|
199
|
+
NegatedMatcher: ~
|
200
|
+
|
201
|
+
RSpec/ClassCheck:
|
202
|
+
Description: Enforces consistent use of `be_a` or `be_kind_of`.
|
203
|
+
StyleGuide: "#is-a-vs-kind-of"
|
204
|
+
Enabled: pending
|
205
|
+
VersionAdded: '2.13'
|
206
|
+
EnforcedStyle: be_a
|
207
|
+
SupportedStyles:
|
208
|
+
- be_a
|
209
|
+
- be_kind_of
|
210
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ClassCheck
|
192
211
|
|
193
212
|
RSpec/ContextMethod:
|
194
213
|
Description: "`context` should not be used for specifying methods."
|
@@ -204,8 +223,9 @@ RSpec/ContextWording:
|
|
204
223
|
- when
|
205
224
|
- with
|
206
225
|
- without
|
226
|
+
AllowedPatterns: []
|
207
227
|
VersionAdded: '1.20'
|
208
|
-
VersionChanged:
|
228
|
+
VersionChanged: '2.13'
|
209
229
|
StyleGuide: https://rspec.rubystyle.guide/#context-descriptions
|
210
230
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
211
231
|
|
@@ -279,8 +299,9 @@ RSpec/Dialect:
|
|
279
299
|
RSpec/EmptyExampleGroup:
|
280
300
|
Description: Checks if an example group does not include any tests.
|
281
301
|
Enabled: true
|
302
|
+
SafeAutoCorrect: false
|
282
303
|
VersionAdded: '1.7'
|
283
|
-
VersionChanged: '2.
|
304
|
+
VersionChanged: '2.13'
|
284
305
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
285
306
|
|
286
307
|
RSpec/EmptyHook:
|
@@ -315,8 +336,10 @@ RSpec/EmptyLineAfterHook:
|
|
315
336
|
Description: Checks if there is an empty line after hook blocks.
|
316
337
|
Enabled: true
|
317
338
|
VersionAdded: '1.27'
|
339
|
+
VersionChanged: '2.13'
|
318
340
|
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
319
341
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
|
342
|
+
AllowConsecutiveOneLiners: true
|
320
343
|
|
321
344
|
RSpec/EmptyLineAfterSubject:
|
322
345
|
Description: Checks if there is an empty line after subject block.
|
@@ -607,10 +630,18 @@ RSpec/NestedGroups:
|
|
607
630
|
Description: Checks for nested example groups.
|
608
631
|
Enabled: true
|
609
632
|
Max: 3
|
633
|
+
AllowedGroups: []
|
610
634
|
VersionAdded: '1.7'
|
611
|
-
VersionChanged: '
|
635
|
+
VersionChanged: '2.13'
|
612
636
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
|
613
637
|
|
638
|
+
RSpec/NoExpectationExample:
|
639
|
+
Description: Checks if an example contains any expectation.
|
640
|
+
Enabled: pending
|
641
|
+
Safe: false
|
642
|
+
VersionAdded: '2.13'
|
643
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NoExpectationExample
|
644
|
+
|
614
645
|
RSpec/NotToNot:
|
615
646
|
Description: Checks for consistent method usage for negating expectations.
|
616
647
|
Enabled: true
|
@@ -775,9 +806,10 @@ RSpec/VariableName:
|
|
775
806
|
SupportedStyles:
|
776
807
|
- snake_case
|
777
808
|
- camelCase
|
809
|
+
AllowedPatterns: []
|
778
810
|
IgnoredPatterns: []
|
779
811
|
VersionAdded: '1.40'
|
780
|
-
VersionChanged: '
|
812
|
+
VersionChanged: '2.13'
|
781
813
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
782
814
|
|
783
815
|
RSpec/VerifiedDoubleReference:
|
@@ -834,6 +866,12 @@ RSpec/Capybara/FeatureMethods:
|
|
834
866
|
VersionChanged: '2.0'
|
835
867
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
836
868
|
|
869
|
+
RSpec/Capybara/SpecificFinders:
|
870
|
+
Description: Checks if there is a more specific finder offered by Capybara.
|
871
|
+
Enabled: pending
|
872
|
+
VersionAdded: '2.13'
|
873
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders
|
874
|
+
|
837
875
|
RSpec/Capybara/SpecificMatcher:
|
838
876
|
Description: Checks for there is a more specific matcher offered by Capybara.
|
839
877
|
Enabled: pending
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#
|
2
|
+
# Configuration of obsolete/deprecated cops used by `ConfigObsoletion`.
|
3
|
+
#
|
4
|
+
# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions
|
5
|
+
#
|
6
|
+
|
7
|
+
# Cop parameters that have been changed
|
8
|
+
# Can be treated as a warning instead of a failure with `severity: warning`
|
9
|
+
changed_parameters:
|
10
|
+
- cops:
|
11
|
+
- RSpec/VariableName
|
12
|
+
parameters: IgnoredPatterns
|
13
|
+
alternative: AllowedPatterns
|
14
|
+
severity: warning
|
@@ -6,16 +6,15 @@ module RuboCop
|
|
6
6
|
# Checks that left braces for adjacent single line lets are aligned.
|
7
7
|
#
|
8
8
|
# @example
|
9
|
+
# # bad
|
10
|
+
# let(:foobar) { blahblah }
|
11
|
+
# let(:baz) { bar }
|
12
|
+
# let(:a) { b }
|
9
13
|
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
# # good
|
16
|
-
# let(:foobar) { blahblah }
|
17
|
-
# let(:baz) { bar }
|
18
|
-
# let(:a) { b }
|
14
|
+
# # good
|
15
|
+
# let(:foobar) { blahblah }
|
16
|
+
# let(:baz) { bar }
|
17
|
+
# let(:a) { b }
|
19
18
|
#
|
20
19
|
class AlignLeftLetBrace < Base
|
21
20
|
extend AutoCorrector
|
@@ -6,16 +6,15 @@ module RuboCop
|
|
6
6
|
# Checks that right braces for adjacent single line lets are aligned.
|
7
7
|
#
|
8
8
|
# @example
|
9
|
+
# # bad
|
10
|
+
# let(:foobar) { blahblah }
|
11
|
+
# let(:baz) { bar }
|
12
|
+
# let(:a) { b }
|
9
13
|
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
# # good
|
16
|
-
# let(:foobar) { blahblah }
|
17
|
-
# let(:baz) { bar }
|
18
|
-
# let(:a) { b }
|
14
|
+
# # good
|
15
|
+
# let(:foobar) { blahblah }
|
16
|
+
# let(:baz) { bar }
|
17
|
+
# let(:a) { b }
|
19
18
|
#
|
20
19
|
class AlignRightLetBrace < Base
|
21
20
|
extend AutoCorrector
|
@@ -25,23 +25,29 @@ module RuboCop
|
|
25
25
|
# some_method
|
26
26
|
# test.run
|
27
27
|
# end
|
28
|
+
#
|
28
29
|
class AroundBlock < Base
|
29
30
|
MSG_NO_ARG = 'Test object should be passed to around block.'
|
30
31
|
MSG_UNUSED_ARG = 'You should call `%<arg>s.call` ' \
|
31
32
|
'or `%<arg>s.run`.'
|
32
33
|
|
33
|
-
# @!method
|
34
|
-
def_node_matcher :
|
34
|
+
# @!method hook_block(node)
|
35
|
+
def_node_matcher :hook_block, <<-PATTERN
|
35
36
|
(block (send nil? :around sym ?) (args $...) ...)
|
36
37
|
PATTERN
|
37
38
|
|
39
|
+
# @!method hook_numblock(node)
|
40
|
+
def_node_matcher :hook_numblock, <<-PATTERN
|
41
|
+
(numblock (send nil? :around sym ?) ...)
|
42
|
+
PATTERN
|
43
|
+
|
38
44
|
# @!method find_arg_usage(node)
|
39
45
|
def_node_search :find_arg_usage, <<-PATTERN
|
40
46
|
{(send $... {:call :run}) (send _ _ $...) (yield $...) (block-pass $...)}
|
41
47
|
PATTERN
|
42
48
|
|
43
49
|
def on_block(node)
|
44
|
-
|
50
|
+
hook_block(node) do |(example_proxy)|
|
45
51
|
if example_proxy.nil?
|
46
52
|
add_no_arg_offense(node)
|
47
53
|
else
|
@@ -50,6 +56,12 @@ module RuboCop
|
|
50
56
|
end
|
51
57
|
end
|
52
58
|
|
59
|
+
def on_numblock(node)
|
60
|
+
hook_numblock(node) do
|
61
|
+
check_for_numblock(node)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
53
65
|
private
|
54
66
|
|
55
67
|
def add_no_arg_offense(node)
|
@@ -68,6 +80,17 @@ module RuboCop
|
|
68
80
|
message: format(MSG_UNUSED_ARG, arg: name)
|
69
81
|
)
|
70
82
|
end
|
83
|
+
|
84
|
+
def check_for_numblock(block)
|
85
|
+
find_arg_usage(block) do |usage|
|
86
|
+
return if usage.include?(s(:lvar, :_1))
|
87
|
+
end
|
88
|
+
|
89
|
+
add_offense(
|
90
|
+
block.children.last,
|
91
|
+
message: format(MSG_UNUSED_ARG, arg: :_1)
|
92
|
+
)
|
93
|
+
end
|
71
94
|
end
|
72
95
|
end
|
73
96
|
end
|
data/lib/rubocop/cop/rspec/be.rb
CHANGED
@@ -23,6 +23,7 @@ module RuboCop
|
|
23
23
|
# before(:each) { Widget.create }
|
24
24
|
# after(:each) { Widget.delete_all }
|
25
25
|
# end
|
26
|
+
#
|
26
27
|
class BeforeAfterAll < Base
|
27
28
|
MSG = 'Beware of using `%<hook>s` as it may cause state to leak ' \
|
28
29
|
'between tests. If you are using `rspec-rails`, and ' \
|
@@ -14,14 +14,20 @@ module RuboCop
|
|
14
14
|
# which ensures that preceding actions (like `click_link`) have
|
15
15
|
# completed.
|
16
16
|
#
|
17
|
+
# This cop does not support autocorrection in some cases.
|
18
|
+
#
|
17
19
|
# @example
|
18
20
|
# # bad
|
19
21
|
# expect(current_path).to eq('/callback')
|
20
|
-
# expect(page.current_path).to match(/widgets/)
|
21
22
|
#
|
22
23
|
# # good
|
23
|
-
# expect(page).to have_current_path(
|
24
|
-
#
|
24
|
+
# expect(page).to have_current_path('/callback')
|
25
|
+
#
|
26
|
+
# # bad (does not support autocorrection)
|
27
|
+
# expect(page.current_path).to match(variable)
|
28
|
+
#
|
29
|
+
# # good
|
30
|
+
# expect(page).to have_current_path('/callback')
|
25
31
|
#
|
26
32
|
class CurrentPathExpectation < Base
|
27
33
|
extend AutoCorrector
|
@@ -40,6 +40,7 @@ module RuboCop
|
|
40
40
|
# # ...
|
41
41
|
# end
|
42
42
|
# end
|
43
|
+
#
|
43
44
|
class FeatureMethods < Base
|
44
45
|
extend AutoCorrector
|
45
46
|
include InsideExampleGroup
|
@@ -68,7 +69,7 @@ module RuboCop
|
|
68
69
|
...)
|
69
70
|
PATTERN
|
70
71
|
|
71
|
-
def on_block(node)
|
72
|
+
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
|
72
73
|
return unless inside_example_group?(node)
|
73
74
|
|
74
75
|
feature_method(node) do |send_node, match|
|