rubocop-rspec 1.43.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +40 -4
 - data/README.md +4 -0
 - data/config/default.yml +141 -25
 - data/lib/rubocop-rspec.rb +7 -8
 - data/lib/rubocop/cop/rspec/align_left_let_brace.rb +7 -3
 - data/lib/rubocop/cop/rspec/align_right_let_brace.rb +7 -3
 - data/lib/rubocop/cop/rspec/around_block.rb +1 -1
 - data/lib/rubocop/cop/rspec/base.rb +7 -54
 - data/lib/rubocop/cop/rspec/be.rb +1 -1
 - data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +2 -2
 - data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +3 -2
 - data/lib/rubocop/cop/rspec/describe_class.rb +33 -14
 - data/lib/rubocop/cop/rspec/describe_method.rb +1 -1
 - data/lib/rubocop/cop/rspec/described_class.rb +1 -2
 - data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +1 -2
 - data/lib/rubocop/cop/rspec/dialect.rb +1 -1
 - data/lib/rubocop/cop/rspec/empty_example_group.rb +33 -38
 - data/lib/rubocop/cop/rspec/empty_hook.rb +1 -1
 - data/lib/rubocop/cop/rspec/empty_line_after_example.rb +1 -1
 - data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +1 -1
 - data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +1 -1
 - data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +1 -1
 - data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +2 -2
 - data/lib/rubocop/cop/rspec/expect_actual.rb +1 -1
 - data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -1
 - data/lib/rubocop/cop/rspec/file_path.rb +2 -2
 - data/lib/rubocop/cop/rspec/focus.rb +13 -7
 - data/lib/rubocop/cop/rspec/hook_argument.rb +2 -4
 - data/lib/rubocop/cop/rspec/hooks_before_examples.rb +2 -2
 - data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +1 -2
 - data/lib/rubocop/cop/rspec/implicit_expect.rb +1 -1
 - data/lib/rubocop/cop/rspec/instance_variable.rb +1 -1
 - data/lib/rubocop/cop/rspec/leading_subject.rb +5 -1
 - data/lib/rubocop/cop/rspec/let_before_examples.rb +2 -2
 - data/lib/rubocop/cop/rspec/let_setup.rb +7 -4
 - data/lib/rubocop/cop/rspec/message_spies.rb +1 -1
 - data/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb +51 -0
 - data/lib/rubocop/cop/rspec/mixin/final_end_location.rb +19 -0
 - data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +54 -0
 - data/lib/rubocop/cop/rspec/mixin/variable.rb +20 -0
 - data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -1
 - data/lib/rubocop/cop/rspec/multiple_expectations.rb +1 -1
 - data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +3 -1
 - data/lib/rubocop/cop/rspec/named_subject.rb +8 -12
 - data/lib/rubocop/cop/rspec/nested_groups.rb +1 -1
 - data/lib/rubocop/cop/rspec/overwriting_setup.rb +2 -1
 - data/lib/rubocop/cop/rspec/pending.rb +13 -5
 - data/lib/rubocop/cop/rspec/predicate_matcher.rb +3 -3
 - data/lib/rubocop/cop/rspec/repeated_include_example.rb +104 -0
 - data/lib/rubocop/cop/rspec/shared_context.rb +16 -6
 - data/lib/rubocop/cop/rspec/shared_examples.rb +3 -1
 - data/lib/rubocop/cop/rspec/stubbed_mock.rb +172 -0
 - data/lib/rubocop/cop/rspec/subject_stub.rb +6 -6
 - data/lib/rubocop/cop/rspec/variable_definition.rb +1 -1
 - data/lib/rubocop/cop/rspec/variable_name.rb +1 -1
 - data/lib/rubocop/cop/rspec_cops.rb +2 -1
 - data/lib/rubocop/rspec/align_let_brace.rb +1 -1
 - data/lib/rubocop/rspec/concept.rb +2 -2
 - data/lib/rubocop/rspec/config_formatter.rb +3 -3
 - data/lib/rubocop/rspec/corrector/move_node.rb +1 -1
 - data/lib/rubocop/rspec/example_group.rb +15 -5
 - data/lib/rubocop/rspec/hook.rb +2 -6
 - data/lib/rubocop/rspec/inject.rb +4 -2
 - data/lib/rubocop/rspec/language.rb +144 -105
 - data/lib/rubocop/rspec/language/node_pattern.rb +7 -24
 - data/lib/rubocop/rspec/version.rb +1 -1
 - metadata +25 -13
 - data/lib/rubocop/cop/rspec/cop.rb +0 -10
 - data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +0 -41
 - data/lib/rubocop/rspec.rb +0 -12
 - data/lib/rubocop/rspec/empty_line_separation.rb +0 -48
 - data/lib/rubocop/rspec/final_end_location.rb +0 -17
 - data/lib/rubocop/rspec/top_level_describe.rb +0 -52
 - data/lib/rubocop/rspec/top_level_group.rb +0 -57
 - data/lib/rubocop/rspec/variable.rb +0 -16
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 53f24b40715eb1f00efa9978b77383037e8c9d61d13c23b068928b05043430ca
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2d295003c7eefe76dfc7ca0f29711313b8b18b9c8579ce4464a47b47f412b54e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 15221270a01b2a273708d0e0fd3c35b52a9e40f87f672b2c4b7b547c55df0415394c7d762e4255406553ab26e0432d9a610d38a36d9fa92dddec47209428c856
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7bbcba195d894aa24d2985444421042314dd018f931763164502ee511c857d3010c074e8206f0af777e99b13ac668d1a32e03a8aefaa8dc38b3714c95ceb9555
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,7 +1,39 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #  
     | 
| 
      
 1 
     | 
    
         
            +
            # Changelog
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            ## Master (Unreleased)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            ## 2.0.0 (2020-11-06)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            * Remove deprecated class `::RuboCop::Cop::RSpec::Cop`. ([@bquorning][])
         
     | 
| 
      
 8 
     | 
    
         
            +
            * Retire `RSpec/InvalidPredicateMatcher` cop. ([@pirj][])
         
     | 
| 
      
 9 
     | 
    
         
            +
            * Remove the code responsible for filtering files to inspect. ([@pirj][])
         
     | 
| 
      
 10 
     | 
    
         
            +
            * Make RSpec language elements configurable. ([@sl4vr][])
         
     | 
| 
      
 11 
     | 
    
         
            +
            * Remove `CustomIncludeMethods` `RSpec/EmptyExampleGroup` option in favour of the new RSpec DSL configuration. ([@pirj][])
         
     | 
| 
      
 12 
     | 
    
         
            +
            * Enabled pending cop (`RSpec/StubbedMock`). ([@pirj][])
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ## 2.0.0.pre (2020-10-22)
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            * Update RuboCop dependency to v1.0.0. ([@bquorning][])
         
     | 
| 
      
 17 
     | 
    
         
            +
            * Change namespace of several cops (`Capybara/*` -> `RSpec/Capybara/*`, `FactoryBot/*` -> `RSpec/FactoryBot/*`, `Rails/*` -> `RSpec/Rails/*`). ([@pirj][], [@bquorning][])
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ## 1.44.1 (2020-10-20)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            * Relax `rubocop-ast` version constraint. ([@PhilCoggins][])
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## 1.44.0 (2020-10-20)
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            * Move our documentation from rubocop-rspec.readthedocs.io to docs.rubocop.org/rubocop-rspec. ([@bquorning][])
         
     | 
| 
      
 26 
     | 
    
         
            +
            * Add `RSpec/RepeatedIncludeExample` cop. ([@biinari][])
         
     | 
| 
      
 27 
     | 
    
         
            +
            * Add `RSpec/StubbedMock` cop. ([@bquorning][], [@pirj][])
         
     | 
| 
      
 28 
     | 
    
         
            +
            * Add `IgnoredMetadata` configuration option to `RSpec/DescribeClass`. ([@Rafix02][])
         
     | 
| 
      
 29 
     | 
    
         
            +
            * Fix false positives in `RSpec/EmptyExampleGroup`. ([@pirj][])
         
     | 
| 
      
 30 
     | 
    
         
            +
            * Fix a false positive for `RSpec/EmptyExampleGroup` when example is defined in an `if` branch. ([@koic][])
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            ## 1.43.2 (2020-08-25)
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            * Fix `RSpec/FilePath` when checking a file with a shared example. ([@pirj][])
         
     | 
| 
      
 35 
     | 
    
         
            +
            * Fix subject nesting detection in `RSpec/LeadingSubject`. ([@pirj][])
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
       5 
37 
     | 
    
         
             
            ## 1.43.1 (2020-08-17)
         
     | 
| 
       6 
38 
     | 
    
         | 
| 
       7 
39 
     | 
    
         
             
            * Fix `RSpec/FilePath` when checking a file defining e.g. an empty class. ([@bquorning][])
         
     | 
| 
         @@ -501,8 +533,8 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features. 
     | 
|
| 
       501 
533 
     | 
    
         
             
            [@rspeicher]: https://github.com/rspeicher
         
     | 
| 
       502 
534 
     | 
    
         
             
            [@jonatas]: https://github.com/jonatas
         
     | 
| 
       503 
535 
     | 
    
         
             
            [@pocke]: https://github.com/pocke
         
     | 
| 
       504 
     | 
    
         
            -
            [@bmorrall]: https 
     | 
| 
       505 
     | 
    
         
            -
            [@zverok]: https 
     | 
| 
      
 536 
     | 
    
         
            +
            [@bmorrall]: https://github.com/bmorrall
         
     | 
| 
      
 537 
     | 
    
         
            +
            [@zverok]: https://github.com/zverok
         
     | 
| 
       506 
538 
     | 
    
         
             
            [@timrogers]: https://github.com/timrogers
         
     | 
| 
       507 
539 
     | 
    
         
             
            [@yevhene]: https://github.com/yevhene
         
     | 
| 
       508 
540 
     | 
    
         
             
            [@walf443]: https://github.com/walf443
         
     | 
| 
         @@ -547,6 +579,10 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features. 
     | 
|
| 
       547 
579 
     | 
    
         
             
            [@andrykonchin]: https://github.com/andrykonchin
         
     | 
| 
       548 
580 
     | 
    
         
             
            [@harrylewis]: https://github.com/harrylewis
         
     | 
| 
       549 
581 
     | 
    
         
             
            [@elliterate]: https://github.com/elliterate
         
     | 
| 
       550 
     | 
    
         
            -
            [@mlarraz]: https://github.com/mlarraz
         
     | 
| 
       551 
582 
     | 
    
         
             
            [@jtannas]: https://github.com/jtannas
         
     | 
| 
       552 
583 
     | 
    
         
             
            [@mockdeep]: https://github.com/mockdeep
         
     | 
| 
      
 584 
     | 
    
         
            +
            [@biinari]: https://github.com/biinari
         
     | 
| 
      
 585 
     | 
    
         
            +
            [@koic]: https://github.com/koic
         
     | 
| 
      
 586 
     | 
    
         
            +
            [@Rafix02]: https://github.com/Rafix02
         
     | 
| 
      
 587 
     | 
    
         
            +
            [@PhilCoggins]: https://github.com/PhilCoggins
         
     | 
| 
      
 588 
     | 
    
         
            +
            [@sl4vr]: https://github.com/sl4vr
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -23,6 +23,10 @@ or if you use bundler put this in your `Gemfile` 
     | 
|
| 
       23 
23 
     | 
    
         
             
            gem 'rubocop-rspec', require: false
         
     | 
| 
       24 
24 
     | 
    
         
             
            ```
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
            ### Upgrading to RuboCop RSpec v2.x
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            Read all the details in our [Upgrade to Version 2.x](https://docs.rubocop.org/rubocop-rspec/2.0/upgrade_to_version_2.html) document.
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       26 
30 
     | 
    
         
             
            ## Usage
         
     | 
| 
       27 
31 
     | 
    
         | 
| 
       28 
32 
     | 
    
         
             
            You need to tell RuboCop to load the RSpec extension. There are three
         
     | 
    
        data/config/default.yml
    CHANGED
    
    | 
         @@ -1,14 +1,85 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
               
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            RSpec:
         
     | 
| 
      
 3 
     | 
    
         
            +
              Include:
         
     | 
| 
      
 4 
     | 
    
         
            +
              - "**/*_spec.rb"
         
     | 
| 
      
 5 
     | 
    
         
            +
              - "**/spec/**/*"
         
     | 
| 
      
 6 
     | 
    
         
            +
              Language:
         
     | 
| 
      
 7 
     | 
    
         
            +
                ExampleGroups:
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Regular:
         
     | 
| 
      
 9 
     | 
    
         
            +
                  - describe
         
     | 
| 
      
 10 
     | 
    
         
            +
                  - context
         
     | 
| 
      
 11 
     | 
    
         
            +
                  - feature
         
     | 
| 
      
 12 
     | 
    
         
            +
                  - example_group
         
     | 
| 
      
 13 
     | 
    
         
            +
                  Skipped:
         
     | 
| 
      
 14 
     | 
    
         
            +
                  - xdescribe
         
     | 
| 
      
 15 
     | 
    
         
            +
                  - xcontext
         
     | 
| 
      
 16 
     | 
    
         
            +
                  - xfeature
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Focused:
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - fdescribe
         
     | 
| 
      
 19 
     | 
    
         
            +
                  - fcontext
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - ffeature
         
     | 
| 
      
 21 
     | 
    
         
            +
                Examples:
         
     | 
| 
      
 22 
     | 
    
         
            +
                  Regular:
         
     | 
| 
      
 23 
     | 
    
         
            +
                  - it
         
     | 
| 
      
 24 
     | 
    
         
            +
                  - specify
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - example
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - scenario
         
     | 
| 
      
 27 
     | 
    
         
            +
                  - its
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Focused:
         
     | 
| 
      
 29 
     | 
    
         
            +
                  - fit
         
     | 
| 
      
 30 
     | 
    
         
            +
                  - fspecify
         
     | 
| 
      
 31 
     | 
    
         
            +
                  - fexample
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - fscenario
         
     | 
| 
      
 33 
     | 
    
         
            +
                  - focus
         
     | 
| 
      
 34 
     | 
    
         
            +
                  Skipped:
         
     | 
| 
      
 35 
     | 
    
         
            +
                  - xit
         
     | 
| 
      
 36 
     | 
    
         
            +
                  - xspecify
         
     | 
| 
      
 37 
     | 
    
         
            +
                  - xexample
         
     | 
| 
      
 38 
     | 
    
         
            +
                  - xscenario
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - skip
         
     | 
| 
      
 40 
     | 
    
         
            +
                  Pending:
         
     | 
| 
      
 41 
     | 
    
         
            +
                  - pending
         
     | 
| 
      
 42 
     | 
    
         
            +
                Expectations:
         
     | 
| 
      
 43 
     | 
    
         
            +
                - expect
         
     | 
| 
      
 44 
     | 
    
         
            +
                - is_expected
         
     | 
| 
      
 45 
     | 
    
         
            +
                - expect_any_instance_of
         
     | 
| 
      
 46 
     | 
    
         
            +
                Helpers:
         
     | 
| 
      
 47 
     | 
    
         
            +
                - let
         
     | 
| 
      
 48 
     | 
    
         
            +
                - let!
         
     | 
| 
      
 49 
     | 
    
         
            +
                Hooks:
         
     | 
| 
      
 50 
     | 
    
         
            +
                - prepend_before
         
     | 
| 
      
 51 
     | 
    
         
            +
                - before
         
     | 
| 
      
 52 
     | 
    
         
            +
                - append_before
         
     | 
| 
      
 53 
     | 
    
         
            +
                - around
         
     | 
| 
      
 54 
     | 
    
         
            +
                - prepend_after
         
     | 
| 
      
 55 
     | 
    
         
            +
                - after
         
     | 
| 
      
 56 
     | 
    
         
            +
                - append_after
         
     | 
| 
      
 57 
     | 
    
         
            +
                HookScopes:
         
     | 
| 
      
 58 
     | 
    
         
            +
                - each
         
     | 
| 
      
 59 
     | 
    
         
            +
                - example
         
     | 
| 
      
 60 
     | 
    
         
            +
                - context
         
     | 
| 
      
 61 
     | 
    
         
            +
                - all
         
     | 
| 
      
 62 
     | 
    
         
            +
                - suite
         
     | 
| 
      
 63 
     | 
    
         
            +
                Includes:
         
     | 
| 
      
 64 
     | 
    
         
            +
                  Examples:
         
     | 
| 
      
 65 
     | 
    
         
            +
                  - it_behaves_like
         
     | 
| 
      
 66 
     | 
    
         
            +
                  - it_should_behave_like
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - include_examples
         
     | 
| 
      
 68 
     | 
    
         
            +
                  Context:
         
     | 
| 
      
 69 
     | 
    
         
            +
                  - include_context
         
     | 
| 
      
 70 
     | 
    
         
            +
                Runners:
         
     | 
| 
      
 71 
     | 
    
         
            +
                - to
         
     | 
| 
      
 72 
     | 
    
         
            +
                - to_not
         
     | 
| 
      
 73 
     | 
    
         
            +
                - not_to
         
     | 
| 
      
 74 
     | 
    
         
            +
                SharedGroups:
         
     | 
| 
      
 75 
     | 
    
         
            +
                  Examples:
         
     | 
| 
      
 76 
     | 
    
         
            +
                  - shared_examples
         
     | 
| 
      
 77 
     | 
    
         
            +
                  - shared_examples_for
         
     | 
| 
      
 78 
     | 
    
         
            +
                  Context:
         
     | 
| 
      
 79 
     | 
    
         
            +
                  - shared_context
         
     | 
| 
      
 80 
     | 
    
         
            +
                Subjects:
         
     | 
| 
      
 81 
     | 
    
         
            +
                - subject
         
     | 
| 
      
 82 
     | 
    
         
            +
                - subject!
         
     | 
| 
       12 
83 
     | 
    
         | 
| 
       13 
84 
     | 
    
         
             
            RSpec/AlignLeftLetBrace:
         
     | 
| 
       14 
85 
     | 
    
         
             
              Description: Checks that left braces for adjacent single line lets are aligned.
         
     | 
| 
         @@ -76,7 +147,23 @@ RSpec/ContextWording: 
     | 
|
| 
       76 
147 
     | 
    
         
             
            RSpec/DescribeClass:
         
     | 
| 
       77 
148 
     | 
    
         
             
              Description: Check that the first argument to the top-level describe is a constant.
         
     | 
| 
       78 
149 
     | 
    
         
             
              Enabled: true
         
     | 
| 
      
 150 
     | 
    
         
            +
              IgnoredMetadata:
         
     | 
| 
      
 151 
     | 
    
         
            +
                type:
         
     | 
| 
      
 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
         
     | 
| 
       79 
165 
     | 
    
         
             
              VersionAdded: '1.0'
         
     | 
| 
      
 166 
     | 
    
         
            +
              VersionChanged: '1.44'
         
     | 
| 
       80 
167 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
         
     | 
| 
       81 
168 
     | 
    
         | 
| 
       82 
169 
     | 
    
         
             
            RSpec/DescribeMethod:
         
     | 
| 
         @@ -120,8 +207,8 @@ RSpec/Dialect: 
     | 
|
| 
       120 
207 
     | 
    
         
             
            RSpec/EmptyExampleGroup:
         
     | 
| 
       121 
208 
     | 
    
         
             
              Description: Checks if an example group does not include any tests.
         
     | 
| 
       122 
209 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       123 
     | 
    
         
            -
              CustomIncludeMethods: []
         
     | 
| 
       124 
210 
     | 
    
         
             
              VersionAdded: '1.7'
         
     | 
| 
      
 211 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       125 
212 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
         
     | 
| 
       126 
213 
     | 
    
         | 
| 
       127 
214 
     | 
    
         
             
            RSpec/EmptyHook:
         
     | 
| 
         @@ -225,6 +312,9 @@ RSpec/ExpectOutput: 
     | 
|
| 
       225 
312 
     | 
    
         
             
            RSpec/FilePath:
         
     | 
| 
       226 
313 
     | 
    
         
             
              Description: Checks that spec file paths are consistent and well-formed.
         
     | 
| 
       227 
314 
     | 
    
         
             
              Enabled: true
         
     | 
| 
      
 315 
     | 
    
         
            +
              Include:
         
     | 
| 
      
 316 
     | 
    
         
            +
              - "**/*_spec*rb*"
         
     | 
| 
      
 317 
     | 
    
         
            +
              - "**/spec/**/*"
         
     | 
| 
       228 
318 
     | 
    
         
             
              CustomTransform:
         
     | 
| 
       229 
319 
     | 
    
         
             
                RuboCop: rubocop
         
     | 
| 
       230 
320 
     | 
    
         
             
                RSpec: rspec
         
     | 
| 
         @@ -299,12 +389,6 @@ RSpec/InstanceVariable: 
     | 
|
| 
       299 
389 
     | 
    
         
             
              VersionChanged: '1.7'
         
     | 
| 
       300 
390 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
         
     | 
| 
       301 
391 
     | 
    
         | 
| 
       302 
     | 
    
         
            -
            RSpec/InvalidPredicateMatcher:
         
     | 
| 
       303 
     | 
    
         
            -
              Description: Checks invalid usage for predicate matcher.
         
     | 
| 
       304 
     | 
    
         
            -
              Enabled: true
         
     | 
| 
       305 
     | 
    
         
            -
              VersionAdded: '1.16'
         
     | 
| 
       306 
     | 
    
         
            -
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher
         
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
392 
     | 
    
         
             
            RSpec/ItBehavesLike:
         
     | 
| 
       309 
393 
     | 
    
         
             
              Description: Checks that only one `it_behaves_like` style is used.
         
     | 
| 
       310 
394 
     | 
    
         
             
              Enabled: true
         
     | 
| 
         @@ -494,6 +578,12 @@ RSpec/RepeatedExampleGroupDescription: 
     | 
|
| 
       494 
578 
     | 
    
         
             
              VersionAdded: '1.38'
         
     | 
| 
       495 
579 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
         
     | 
| 
       496 
580 
     | 
    
         | 
| 
      
 581 
     | 
    
         
            +
            RSpec/RepeatedIncludeExample:
         
     | 
| 
      
 582 
     | 
    
         
            +
              Description: Check for repeated include of shared examples.
         
     | 
| 
      
 583 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 584 
     | 
    
         
            +
              VersionAdded: '1.44'
         
     | 
| 
      
 585 
     | 
    
         
            +
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
         
     | 
| 
      
 586 
     | 
    
         
            +
             
     | 
| 
       497 
587 
     | 
    
         
             
            RSpec/ReturnFromStub:
         
     | 
| 
       498 
588 
     | 
    
         
             
              Description: Checks for consistent style of stub's return setting.
         
     | 
| 
       499 
589 
     | 
    
         
             
              Enabled: true
         
     | 
| 
         @@ -537,6 +627,12 @@ RSpec/SingleArgumentMessageChain: 
     | 
|
| 
       537 
627 
     | 
    
         
             
              VersionChanged: '1.10'
         
     | 
| 
       538 
628 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
         
     | 
| 
       539 
629 
     | 
    
         | 
| 
      
 630 
     | 
    
         
            +
            RSpec/StubbedMock:
         
     | 
| 
      
 631 
     | 
    
         
            +
              Description: Checks that message expectations do not have a configured response.
         
     | 
| 
      
 632 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 633 
     | 
    
         
            +
              VersionAdded: '1.44'
         
     | 
| 
      
 634 
     | 
    
         
            +
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
         
     | 
| 
      
 635 
     | 
    
         
            +
             
     | 
| 
       540 
636 
     | 
    
         
             
            RSpec/SubjectStub:
         
     | 
| 
       541 
637 
     | 
    
         
             
              Description: Checks for stubbed test subjects.
         
     | 
| 
       542 
638 
     | 
    
         
             
              Enabled: true
         
     | 
| 
         @@ -592,49 +688,68 @@ RSpec/Yield: 
     | 
|
| 
       592 
688 
     | 
    
         
             
              VersionAdded: '1.32'
         
     | 
| 
       593 
689 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
         
     | 
| 
       594 
690 
     | 
    
         | 
| 
       595 
     | 
    
         
            -
            Capybara/CurrentPathExpectation:
         
     | 
| 
      
 691 
     | 
    
         
            +
            RSpec/Capybara/CurrentPathExpectation:
         
     | 
| 
       596 
692 
     | 
    
         
             
              Description: Checks that no expectations are set on Capybara's `current_path`.
         
     | 
| 
       597 
693 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       598 
694 
     | 
    
         
             
              VersionAdded: '1.18'
         
     | 
| 
      
 695 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       599 
696 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
         
     | 
| 
       600 
697 
     | 
    
         | 
| 
       601 
     | 
    
         
            -
            Capybara/FeatureMethods:
         
     | 
| 
      
 698 
     | 
    
         
            +
            RSpec/Capybara/FeatureMethods:
         
     | 
| 
       602 
699 
     | 
    
         
             
              Description: Checks for consistent method usage in feature specs.
         
     | 
| 
       603 
700 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       604 
701 
     | 
    
         
             
              EnabledMethods: []
         
     | 
| 
       605 
702 
     | 
    
         
             
              VersionAdded: '1.17'
         
     | 
| 
       606 
     | 
    
         
            -
              VersionChanged: ' 
     | 
| 
      
 703 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       607 
704 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
         
     | 
| 
       608 
705 
     | 
    
         | 
| 
       609 
     | 
    
         
            -
            Capybara/VisibilityMatcher:
         
     | 
| 
      
 706 
     | 
    
         
            +
            RSpec/Capybara/VisibilityMatcher:
         
     | 
| 
       610 
707 
     | 
    
         
             
              Description: Checks for boolean visibility in capybara finders.
         
     | 
| 
       611 
708 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       612 
709 
     | 
    
         
             
              VersionAdded: '1.39'
         
     | 
| 
      
 710 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       613 
711 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
         
     | 
| 
       614 
712 
     | 
    
         | 
| 
       615 
     | 
    
         
            -
            FactoryBot/AttributeDefinedStatically:
         
     | 
| 
      
 713 
     | 
    
         
            +
            RSpec/FactoryBot/AttributeDefinedStatically:
         
     | 
| 
       616 
714 
     | 
    
         
             
              Description: Always declare attribute values as blocks.
         
     | 
| 
       617 
715 
     | 
    
         
             
              Enabled: true
         
     | 
| 
      
 716 
     | 
    
         
            +
              Include:
         
     | 
| 
      
 717 
     | 
    
         
            +
              - spec/factories.rb
         
     | 
| 
      
 718 
     | 
    
         
            +
              - spec/factories/**/*.rb
         
     | 
| 
      
 719 
     | 
    
         
            +
              - features/support/factories/**/*.rb
         
     | 
| 
       618 
720 
     | 
    
         
             
              VersionAdded: '1.28'
         
     | 
| 
      
 721 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       619 
722 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
         
     | 
| 
       620 
723 
     | 
    
         | 
| 
       621 
     | 
    
         
            -
            FactoryBot/CreateList:
         
     | 
| 
      
 724 
     | 
    
         
            +
            RSpec/FactoryBot/CreateList:
         
     | 
| 
       622 
725 
     | 
    
         
             
              Description: Checks for create_list usage.
         
     | 
| 
       623 
726 
     | 
    
         
             
              Enabled: true
         
     | 
| 
      
 727 
     | 
    
         
            +
              Include:
         
     | 
| 
      
 728 
     | 
    
         
            +
              - "**/*_spec.rb"
         
     | 
| 
      
 729 
     | 
    
         
            +
              - "**/spec/**/*"
         
     | 
| 
      
 730 
     | 
    
         
            +
              - spec/factories.rb
         
     | 
| 
      
 731 
     | 
    
         
            +
              - spec/factories/**/*.rb
         
     | 
| 
      
 732 
     | 
    
         
            +
              - features/support/factories/**/*.rb
         
     | 
| 
       624 
733 
     | 
    
         
             
              EnforcedStyle: create_list
         
     | 
| 
       625 
734 
     | 
    
         
             
              SupportedStyles:
         
     | 
| 
       626 
735 
     | 
    
         
             
              - create_list
         
     | 
| 
       627 
736 
     | 
    
         
             
              - n_times
         
     | 
| 
       628 
737 
     | 
    
         
             
              VersionAdded: '1.25'
         
     | 
| 
      
 738 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       629 
739 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
         
     | 
| 
       630 
740 
     | 
    
         | 
| 
       631 
     | 
    
         
            -
            FactoryBot/FactoryClassName:
         
     | 
| 
      
 741 
     | 
    
         
            +
            RSpec/FactoryBot/FactoryClassName:
         
     | 
| 
       632 
742 
     | 
    
         
             
              Description: Use string value when setting the class attribute explicitly.
         
     | 
| 
       633 
743 
     | 
    
         
             
              Enabled: true
         
     | 
| 
      
 744 
     | 
    
         
            +
              Include:
         
     | 
| 
      
 745 
     | 
    
         
            +
              - spec/factories.rb
         
     | 
| 
      
 746 
     | 
    
         
            +
              - spec/factories/**/*.rb
         
     | 
| 
      
 747 
     | 
    
         
            +
              - features/support/factories/**/*.rb
         
     | 
| 
       634 
748 
     | 
    
         
             
              VersionAdded: '1.37'
         
     | 
| 
      
 749 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       635 
750 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
         
     | 
| 
       636 
751 
     | 
    
         | 
| 
       637 
     | 
    
         
            -
            Rails/HttpStatus:
         
     | 
| 
      
 752 
     | 
    
         
            +
            RSpec/Rails/HttpStatus:
         
     | 
| 
       638 
753 
     | 
    
         
             
              Description: Enforces use of symbolic or numeric value to describe HTTP status.
         
     | 
| 
       639 
754 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       640 
755 
     | 
    
         
             
              EnforcedStyle: symbolic
         
     | 
| 
         @@ -642,4 +757,5 @@ Rails/HttpStatus: 
     | 
|
| 
       642 
757 
     | 
    
         
             
              - numeric
         
     | 
| 
       643 
758 
     | 
    
         
             
              - symbolic
         
     | 
| 
       644 
759 
     | 
    
         
             
              VersionAdded: '1.23'
         
     | 
| 
      
 760 
     | 
    
         
            +
              VersionChanged: '2.0'
         
     | 
| 
       645 
761 
     | 
    
         
             
              StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
         
     | 
    
        data/lib/rubocop-rspec.rb
    CHANGED
    
    | 
         @@ -5,26 +5,25 @@ require 'yaml' 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            require 'rubocop'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            require_relative 'rubocop/rspec'
         
     | 
| 
       9 
8 
     | 
    
         
             
            require_relative 'rubocop/rspec/version'
         
     | 
| 
       10 
9 
     | 
    
         
             
            require_relative 'rubocop/rspec/inject'
         
     | 
| 
       11 
10 
     | 
    
         
             
            require_relative 'rubocop/rspec/node'
         
     | 
| 
       12 
     | 
    
         
            -
            require_relative 'rubocop/rspec/top_level_describe'
         
     | 
| 
       13 
11 
     | 
    
         
             
            require_relative 'rubocop/rspec/wording'
         
     | 
| 
       14 
     | 
    
         
            -
            require_relative 'rubocop/rspec/language'
         
     | 
| 
       15 
12 
     | 
    
         
             
            require_relative 'rubocop/rspec/language/node_pattern'
         
     | 
| 
       16 
     | 
    
         
            -
            require_relative 'rubocop/rspec/ 
     | 
| 
      
 13 
     | 
    
         
            +
            require_relative 'rubocop/rspec/language'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            require_relative 'rubocop/cop/rspec/mixin/top_level_group'
         
     | 
| 
      
 16 
     | 
    
         
            +
            require_relative 'rubocop/cop/rspec/mixin/variable'
         
     | 
| 
      
 17 
     | 
    
         
            +
            require_relative 'rubocop/cop/rspec/mixin/final_end_location'
         
     | 
| 
      
 18 
     | 
    
         
            +
            require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       17 
20 
     | 
    
         
             
            require_relative 'rubocop/rspec/concept'
         
     | 
| 
       18 
21 
     | 
    
         
             
            require_relative 'rubocop/rspec/example_group'
         
     | 
| 
       19 
22 
     | 
    
         
             
            require_relative 'rubocop/rspec/example'
         
     | 
| 
       20 
23 
     | 
    
         
             
            require_relative 'rubocop/rspec/hook'
         
     | 
| 
       21 
     | 
    
         
            -
            require_relative 'rubocop/rspec/variable'
         
     | 
| 
       22 
24 
     | 
    
         
             
            require_relative 'rubocop/cop/rspec/base'
         
     | 
| 
       23 
     | 
    
         
            -
            require_relative 'rubocop/cop/rspec/cop'
         
     | 
| 
       24 
25 
     | 
    
         
             
            require_relative 'rubocop/rspec/align_let_brace'
         
     | 
| 
       25 
26 
     | 
    
         
             
            require_relative 'rubocop/rspec/factory_bot'
         
     | 
| 
       26 
     | 
    
         
            -
            require_relative 'rubocop/rspec/final_end_location'
         
     | 
| 
       27 
     | 
    
         
            -
            require_relative 'rubocop/rspec/empty_line_separation'
         
     | 
| 
       28 
27 
     | 
    
         
             
            require_relative 'rubocop/rspec/corrector/move_node'
         
     | 
| 
       29 
28 
     | 
    
         | 
| 
       30 
29 
     | 
    
         
             
            RuboCop::RSpec::Inject.defaults!
         
     | 
| 
         @@ -27,11 +27,9 @@ module RuboCop 
     | 
|
| 
       27 
27 
     | 
    
         
             
                    end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                    def on_new_investigation
         
     | 
| 
      
 30 
     | 
    
         
            +
                      super
         
     | 
| 
       30 
31 
     | 
    
         
             
                      return if processed_source.blank?
         
     | 
| 
       31 
32 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                      token_aligner =
         
     | 
| 
       33 
     | 
    
         
            -
                        RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :begin)
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
33 
     | 
    
         
             
                      token_aligner.offending_tokens.each do |let|
         
     | 
| 
       36 
34 
     | 
    
         
             
                        add_offense(let.loc.begin) do |corrector|
         
     | 
| 
       37 
35 
     | 
    
         
             
                          corrector.insert_before(
         
     | 
| 
         @@ -40,6 +38,12 @@ module RuboCop 
     | 
|
| 
       40 
38 
     | 
    
         
             
                        end
         
     | 
| 
       41 
39 
     | 
    
         
             
                      end
         
     | 
| 
       42 
40 
     | 
    
         
             
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    private
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    def token_aligner
         
     | 
| 
      
 45 
     | 
    
         
            +
                      RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :begin)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    end
         
     | 
| 
       43 
47 
     | 
    
         
             
                  end
         
     | 
| 
       44 
48 
     | 
    
         
             
                end
         
     | 
| 
       45 
49 
     | 
    
         
             
              end
         
     | 
| 
         @@ -27,11 +27,9 @@ module RuboCop 
     | 
|
| 
       27 
27 
     | 
    
         
             
                    end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                    def on_new_investigation
         
     | 
| 
      
 30 
     | 
    
         
            +
                      super
         
     | 
| 
       30 
31 
     | 
    
         
             
                      return if processed_source.blank?
         
     | 
| 
       31 
32 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                      token_aligner =
         
     | 
| 
       33 
     | 
    
         
            -
                        RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :end)
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
33 
     | 
    
         
             
                      token_aligner.offending_tokens.each do |let|
         
     | 
| 
       36 
34 
     | 
    
         
             
                        add_offense(let.loc.end) do |corrector|
         
     | 
| 
       37 
35 
     | 
    
         
             
                          corrector.insert_before(
         
     | 
| 
         @@ -40,6 +38,12 @@ module RuboCop 
     | 
|
| 
       40 
38 
     | 
    
         
             
                        end
         
     | 
| 
       41 
39 
     | 
    
         
             
                      end
         
     | 
| 
       42 
40 
     | 
    
         
             
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    private
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    def token_aligner
         
     | 
| 
      
 45 
     | 
    
         
            +
                      RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :end)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    end
         
     | 
| 
       43 
47 
     | 
    
         
             
                  end
         
     | 
| 
       44 
48 
     | 
    
         
             
                end
         
     | 
| 
       45 
49 
     | 
    
         
             
              end
         
     | 
| 
         @@ -31,7 +31,7 @@ module RuboCop 
     | 
|
| 
       31 
31 
     | 
    
         
             
                                     'or `%<arg>s.run`.'
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                    def_node_matcher :hook, <<-PATTERN
         
     | 
| 
       34 
     | 
    
         
            -
                      (block  
     | 
| 
      
 34 
     | 
    
         
            +
                      (block (send nil? :around sym ?) (args $...) ...)
         
     | 
| 
       35 
35 
     | 
    
         
             
                    PATTERN
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
                    def_node_search :find_arg_usage, <<-PATTERN
         
     | 
| 
         @@ -4,69 +4,22 @@ module RuboCop 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Cop
         
     | 
| 
       5 
5 
     | 
    
         
             
                module RSpec
         
     | 
| 
       6 
6 
     | 
    
         
             
                  # @abstract parent class to RSpec cops
         
     | 
| 
       7 
     | 
    
         
            -
                  #
         
     | 
| 
       8 
     | 
    
         
            -
                  # The criteria for whether rubocop-rspec analyzes a certain ruby file
         
     | 
| 
       9 
     | 
    
         
            -
                  # is configured via `AllCops/RSpec`. For example, if you want to
         
     | 
| 
       10 
     | 
    
         
            -
                  # customize your project to scan all files within a `test/` directory
         
     | 
| 
       11 
     | 
    
         
            -
                  # then you could add this to your configuration:
         
     | 
| 
       12 
     | 
    
         
            -
                  #
         
     | 
| 
       13 
     | 
    
         
            -
                  # @example configuring analyzed paths
         
     | 
| 
       14 
     | 
    
         
            -
                  #   # .rubocop.yml
         
     | 
| 
       15 
     | 
    
         
            -
                  #   # AllCops:
         
     | 
| 
       16 
     | 
    
         
            -
                  #   #   RSpec:
         
     | 
| 
       17 
     | 
    
         
            -
                  #   #     Patterns:
         
     | 
| 
       18 
     | 
    
         
            -
                  #   #     - '_test.rb$'
         
     | 
| 
       19 
     | 
    
         
            -
                  #   #     - '(?:^|/)test/'
         
     | 
| 
       20 
7 
     | 
    
         
             
                  class Base < ::RuboCop::Cop::Base
         
     | 
| 
       21 
8 
     | 
    
         
             
                    include RuboCop::RSpec::Language
         
     | 
| 
       22 
     | 
    
         
            -
                     
     | 
| 
      
 9 
     | 
    
         
            +
                    extend RuboCop::RSpec::Language::NodePattern
         
     | 
| 
       23 
10 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                     
     | 
| 
       25 
     | 
    
         
            -
                      RuboCop::RSpec::CONFIG.fetch('AllCops').fetch('RSpec')
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    DEFAULT_PATTERN_RE = Regexp.union(
         
     | 
| 
       28 
     | 
    
         
            -
                      DEFAULT_CONFIGURATION.fetch('Patterns')
         
     | 
| 
       29 
     | 
    
         
            -
                                           .map(&Regexp.public_method(:new))
         
     | 
| 
       30 
     | 
    
         
            -
                    )
         
     | 
| 
      
 11 
     | 
    
         
            +
                    exclude_from_registry
         
     | 
| 
       31 
12 
     | 
    
         | 
| 
       32 
13 
     | 
    
         
             
                    # Invoke the original inherited hook so our cops are recognized
         
     | 
| 
       33 
14 
     | 
    
         
             
                    def self.inherited(subclass) # rubocop:disable Lint/MissingSuper
         
     | 
| 
       34 
15 
     | 
    
         
             
                      RuboCop::Cop::Base.inherited(subclass)
         
     | 
| 
       35 
16 
     | 
    
         
             
                    end
         
     | 
| 
       36 
17 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                     
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                     
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                    def relevant_rubocop_rspec_file?(file)
         
     | 
| 
       44 
     | 
    
         
            -
                      rspec_pattern.match?(file)
         
     | 
| 
       45 
     | 
    
         
            -
                    end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                    def rspec_pattern
         
     | 
| 
       48 
     | 
    
         
            -
                      if rspec_pattern_config?
         
     | 
| 
       49 
     | 
    
         
            -
                        Regexp.union(rspec_pattern_config.map(&Regexp.public_method(:new)))
         
     | 
| 
       50 
     | 
    
         
            -
                      else
         
     | 
| 
       51 
     | 
    
         
            -
                        DEFAULT_PATTERN_RE
         
     | 
| 
       52 
     | 
    
         
            -
                      end
         
     | 
| 
       53 
     | 
    
         
            -
                    end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                    def all_cops_config
         
     | 
| 
       56 
     | 
    
         
            -
                      config
         
     | 
| 
       57 
     | 
    
         
            -
                        .for_all_cops
         
     | 
| 
       58 
     | 
    
         
            -
                    end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                    def rspec_pattern_config?
         
     | 
| 
       61 
     | 
    
         
            -
                      return unless all_cops_config.key?('RSpec')
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                      all_cops_config.fetch('RSpec').key?('Patterns')
         
     | 
| 
       64 
     | 
    
         
            -
                    end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                    def rspec_pattern_config
         
     | 
| 
       67 
     | 
    
         
            -
                      all_cops_config
         
     | 
| 
       68 
     | 
    
         
            -
                        .fetch('RSpec', DEFAULT_CONFIGURATION)
         
     | 
| 
       69 
     | 
    
         
            -
                        .fetch('Patterns')
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # Set the config for dynamic DSL configuration-aware helpers
         
     | 
| 
      
 19 
     | 
    
         
            +
                    # that have no other means of accessing the configuration.
         
     | 
| 
      
 20 
     | 
    
         
            +
                    def on_new_investigation
         
     | 
| 
      
 21 
     | 
    
         
            +
                      super
         
     | 
| 
      
 22 
     | 
    
         
            +
                      RuboCop::RSpec::Language.config = config['RSpec']['Language']
         
     | 
| 
       70 
23 
     | 
    
         
             
                    end
         
     | 
| 
       71 
24 
     | 
    
         
             
                  end
         
     | 
| 
       72 
25 
     | 
    
         
             
                end
         
     |