rubocop-rspec_rails 2.29.1 → 2.31.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 +11 -0
- data/README.md +7 -4
- data/lib/rubocop/cop/rspec_rails/http_status.rb +43 -9
- data/lib/rubocop/cop/rspec_rails/inferred_spec_type.rb +6 -0
- data/lib/rubocop/cop/rspec_rails/minitest_assertions.rb +4 -0
- data/lib/rubocop/cop/rspec_rails/negation_be_valid.rb +12 -0
- data/lib/rubocop/cop/rspec_rails/travel_around.rb +37 -14
- data/lib/rubocop/rspec_rails/description_extractor.rb +2 -2
- data/lib/rubocop/rspec_rails/plugin.rb +35 -0
- data/lib/rubocop/rspec_rails/version.rb +1 -1
- data/lib/rubocop-rspec_rails.rb +1 -23
- metadata +41 -9
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a532f361a0657a600a657dd22a2344028ce648996179c8c4df27ea29302537ac
         | 
| 4 | 
            +
              data.tar.gz: f7d10a791b1c5ee7d6a4444ee15eea12622cec6ecfd2174fafe037d37651a6bb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 976d9b3320ea2923c627597dc7cffb0e0f212ea16430084e60c53345093cebc4dff74e28ee7730900e0955920e2f7fee8f7206c4b583731d9cc58d5c67d67688
         | 
| 7 | 
            +
              data.tar.gz: 657c590a5cb85f4f3b97b08f5dfc57409b07392db055ea1f0e2f7a04e78cd6d9920ca21f298c5d9c3120dc971776fb5429213d576cb91e4ae85713da704dc30a
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -2,6 +2,16 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            ## Master (Unreleased)
         | 
| 4 4 |  | 
| 5 | 
            +
            ## 2.31.0 (2025-03-10)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            - Handle unknown HTTP status codes for `RSpecRails/HttpStatus` cop. ([@viralpraxis])
         | 
| 8 | 
            +
            - Fix a false negative for `RSpecRails/TravelAround` cop when passed as a proc to a travel method. ([@ydah])
         | 
| 9 | 
            +
            - Make RuboCop RSpecRails work as a RuboCop plugin. ([@bquorning])
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## 2.30.0 (2024-06-12)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            - Fix an runtime error for rubocop-rspec +3.0. ([@bquorning])
         | 
| 14 | 
            +
             | 
| 5 15 | 
             
            ## 2.29.1 (2024-06-12)
         | 
| 6 16 |  | 
| 7 17 | 
             
            - Bump RuboCop requirement to +1.61. ([@ydah])
         | 
| @@ -77,4 +87,5 @@ | |
| 77 87 | 
             
            [@r7kamura]: https://github.com/r7kamura
         | 
| 78 88 | 
             
            [@splattael]: https://github.com/splattael
         | 
| 79 89 | 
             
            [@tmaier]: https://github.com/tmaier
         | 
| 90 | 
            +
            [@viralpraxis]: https://github.com/viralpraxis
         | 
| 80 91 | 
             
            [@ydah]: https://github.com/ydah
         | 
    
        data/README.md
    CHANGED
    
    | @@ -33,13 +33,13 @@ ways to do this: | |
| 33 33 | 
             
            Put this into your `.rubocop.yml`.
         | 
| 34 34 |  | 
| 35 35 | 
             
            ```yaml
         | 
| 36 | 
            -
             | 
| 36 | 
            +
            plugins: rubocop-rspec_rails
         | 
| 37 37 | 
             
            ```
         | 
| 38 38 |  | 
| 39 39 | 
             
            Alternatively, use the following array notation when specifying multiple extensions.
         | 
| 40 40 |  | 
| 41 41 | 
             
            ```yaml
         | 
| 42 | 
            -
             | 
| 42 | 
            +
            plugins:
         | 
| 43 43 | 
             
              - rubocop-rspec
         | 
| 44 44 | 
             
              - rubocop-rspec_rails
         | 
| 45 45 | 
             
            ```
         | 
| @@ -47,17 +47,20 @@ require: | |
| 47 47 | 
             
            Now you can run `rubocop` and it will automatically load the RuboCop RSpec Rails
         | 
| 48 48 | 
             
            cops together with the standard cops.
         | 
| 49 49 |  | 
| 50 | 
            +
            > [!NOTE]
         | 
| 51 | 
            +
            > The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
         | 
| 52 | 
            +
             | 
| 50 53 | 
             
            ### Command line
         | 
| 51 54 |  | 
| 52 55 | 
             
            ```bash
         | 
| 53 | 
            -
            rubocop -- | 
| 56 | 
            +
            rubocop --plugin rubocop-rspec_rails
         | 
| 54 57 | 
             
            ```
         | 
| 55 58 |  | 
| 56 59 | 
             
            ### Rake task
         | 
| 57 60 |  | 
| 58 61 | 
             
            ```ruby
         | 
| 59 62 | 
             
            RuboCop::RakeTask.new do |task|
         | 
| 60 | 
            -
              task. | 
| 63 | 
            +
              task.plugins << 'rubocop-rspec_rails'
         | 
| 61 64 | 
             
            end
         | 
| 62 65 | 
             
            ```
         | 
| 63 66 |  | 
| @@ -15,6 +15,7 @@ module RuboCop | |
| 15 15 | 
             
                  # So, this cop does not check if a method starting with `be_*` is used
         | 
| 16 16 | 
             
                  # when setting for `EnforcedStyle: symbolic` or
         | 
| 17 17 | 
             
                  # `EnforcedStyle: numeric`.
         | 
| 18 | 
            +
                  # This cop is also capable of detecting unknown HTTP status codes.
         | 
| 18 19 | 
             
                  #
         | 
| 19 20 | 
             
                  # @example `EnforcedStyle: symbolic` (default)
         | 
| 20 21 | 
             
                  #   # bad
         | 
| @@ -57,6 +58,12 @@ module RuboCop | |
| 57 58 | 
             
                  #   it { is_expected.to have_http_status :success }
         | 
| 58 59 | 
             
                  #   it { is_expected.to have_http_status :error }
         | 
| 59 60 | 
             
                  #
         | 
| 61 | 
            +
                  # @example
         | 
| 62 | 
            +
                  #   # bad
         | 
| 63 | 
            +
                  #   it { is_expected.to have_http_status :oki_doki }
         | 
| 64 | 
            +
                  #
         | 
| 65 | 
            +
                  #   # good
         | 
| 66 | 
            +
                  #   it { is_expected.to have_http_status :ok }
         | 
| 60 67 | 
             
                  class HttpStatus < ::RuboCop::Cop::Base
         | 
| 61 68 | 
             
                    extend AutoCorrector
         | 
| 62 69 | 
             
                    include ConfigurableEnforcedStyle
         | 
| @@ -67,7 +74,7 @@ module RuboCop | |
| 67 74 | 
             
                      (send nil? :have_http_status ${int sym str})
         | 
| 68 75 | 
             
                    PATTERN
         | 
| 69 76 |  | 
| 70 | 
            -
                    def on_send(node)
         | 
| 77 | 
            +
                    def on_send(node) # rubocop:disable Metrics/MethodLength
         | 
| 71 78 | 
             
                      return unless defined?(::Rack::Utils::SYMBOL_TO_STATUS_CODE)
         | 
| 72 79 |  | 
| 73 80 | 
             
                      http_status(node) do |arg|
         | 
| @@ -78,6 +85,8 @@ module RuboCop | |
| 78 85 |  | 
| 79 86 | 
             
                        add_offense(checker.offense_range,
         | 
| 80 87 | 
             
                                    message: checker.message) do |corrector|
         | 
| 88 | 
            +
                          next unless checker.autocorrectable?
         | 
| 89 | 
            +
             | 
| 81 90 | 
             
                          corrector.replace(checker.offense_range, checker.prefer)
         | 
| 82 91 | 
             
                        end
         | 
| 83 92 | 
             
                      end
         | 
| @@ -93,6 +102,10 @@ module RuboCop | |
| 93 102 | 
             
                        NumericStyleChecker
         | 
| 94 103 | 
             
                      when :be_status
         | 
| 95 104 | 
             
                        BeStatusStyleChecker
         | 
| 105 | 
            +
                      else
         | 
| 106 | 
            +
                        # :nocov:
         | 
| 107 | 
            +
                        :noop
         | 
| 108 | 
            +
                        # :nocov:
         | 
| 96 109 | 
             
                      end
         | 
| 97 110 | 
             
                    end
         | 
| 98 111 |  | 
| @@ -100,6 +113,7 @@ module RuboCop | |
| 100 113 | 
             
                    class StyleCheckerBase
         | 
| 101 114 | 
             
                      MSG = 'Prefer `%<prefer>s` over `%<current>s` ' \
         | 
| 102 115 | 
             
                            'to describe HTTP status code.'
         | 
| 116 | 
            +
                      MSG_UNKNOWN_STATUS_CODE = 'Unknown status code.'
         | 
| 103 117 | 
             
                      ALLOWED_STATUSES = %i[error success missing redirect].freeze
         | 
| 104 118 |  | 
| 105 119 | 
             
                      attr_reader :node
         | 
| @@ -109,7 +123,11 @@ module RuboCop | |
| 109 123 | 
             
                      end
         | 
| 110 124 |  | 
| 111 125 | 
             
                      def message
         | 
| 112 | 
            -
                         | 
| 126 | 
            +
                        if autocorrectable?
         | 
| 127 | 
            +
                          format(MSG, prefer: prefer, current: current)
         | 
| 128 | 
            +
                        else
         | 
| 129 | 
            +
                          MSG_UNKNOWN_STATUS_CODE
         | 
| 130 | 
            +
                        end
         | 
| 113 131 | 
             
                      end
         | 
| 114 132 |  | 
| 115 133 | 
             
                      def current
         | 
| @@ -136,6 +154,10 @@ module RuboCop | |
| 136 154 | 
             
                        !node.sym_type? && !custom_http_status_code?
         | 
| 137 155 | 
             
                      end
         | 
| 138 156 |  | 
| 157 | 
            +
                      def autocorrectable?
         | 
| 158 | 
            +
                        !!symbol
         | 
| 159 | 
            +
                      end
         | 
| 160 | 
            +
             | 
| 139 161 | 
             
                      def prefer
         | 
| 140 162 | 
             
                        symbol.inspect
         | 
| 141 163 | 
             
                      end
         | 
| @@ -157,6 +179,10 @@ module RuboCop | |
| 157 179 | 
             
                        !node.int_type? && !allowed_symbol?
         | 
| 158 180 | 
             
                      end
         | 
| 159 181 |  | 
| 182 | 
            +
                      def autocorrectable?
         | 
| 183 | 
            +
                        !!number
         | 
| 184 | 
            +
                      end
         | 
| 185 | 
            +
             | 
| 160 186 | 
             
                      def prefer
         | 
| 161 187 | 
             
                        number.to_s
         | 
| 162 188 | 
             
                      end
         | 
| @@ -179,22 +205,30 @@ module RuboCop | |
| 179 205 | 
             
                          (!node.int_type? && !allowed_symbol?)
         | 
| 180 206 | 
             
                      end
         | 
| 181 207 |  | 
| 208 | 
            +
                      def autocorrectable?
         | 
| 209 | 
            +
                        !!status_code
         | 
| 210 | 
            +
                      end
         | 
| 211 | 
            +
             | 
| 182 212 | 
             
                      def offense_range
         | 
| 183 213 | 
             
                        node.parent
         | 
| 184 214 | 
             
                      end
         | 
| 185 215 |  | 
| 186 216 | 
             
                      def prefer
         | 
| 217 | 
            +
                        "be_#{status_code}"
         | 
| 218 | 
            +
                      end
         | 
| 219 | 
            +
             | 
| 220 | 
            +
                      private
         | 
| 221 | 
            +
             | 
| 222 | 
            +
                      def status_code
         | 
| 187 223 | 
             
                        if node.sym_type?
         | 
| 188 | 
            -
                           | 
| 224 | 
            +
                          node.value
         | 
| 189 225 | 
             
                        elsif node.int_type?
         | 
| 190 | 
            -
                           | 
| 191 | 
            -
                         | 
| 192 | 
            -
                           | 
| 226 | 
            +
                          symbol
         | 
| 227 | 
            +
                        else
         | 
| 228 | 
            +
                          normalize_str
         | 
| 193 229 | 
             
                        end
         | 
| 194 230 | 
             
                      end
         | 
| 195 231 |  | 
| 196 | 
            -
                      private
         | 
| 197 | 
            -
             | 
| 198 232 | 
             
                      def symbol
         | 
| 199 233 | 
             
                        ::Rack::Utils::SYMBOL_TO_STATUS_CODE.key(number)
         | 
| 200 234 | 
             
                      end
         | 
| @@ -207,7 +241,7 @@ module RuboCop | |
| 207 241 | 
             
                        str = node.value.to_s
         | 
| 208 242 | 
             
                        if str.match?(/\A\d+\z/)
         | 
| 209 243 | 
             
                          ::Rack::Utils::SYMBOL_TO_STATUS_CODE.key(str.to_i)
         | 
| 210 | 
            -
                         | 
| 244 | 
            +
                        elsif ::Rack::Utils::SYMBOL_TO_STATUS_CODE.key?(str.to_sym)
         | 
| 211 245 | 
             
                          str
         | 
| 212 246 | 
             
                        end
         | 
| 213 247 | 
             
                      end
         | 
| @@ -93,6 +93,7 @@ module RuboCop | |
| 93 93 |  | 
| 94 94 | 
             
                    # @param [RuboCop::AST::Node] node
         | 
| 95 95 | 
             
                    # @return [Parser::Source::Range]
         | 
| 96 | 
            +
                    # rubocop:disable Metrics/MethodLength
         | 
| 96 97 | 
             
                    def remove_range(node)
         | 
| 97 98 | 
             
                      if node.left_sibling
         | 
| 98 99 | 
             
                        node.source_range.with(
         | 
| @@ -102,8 +103,13 @@ module RuboCop | |
| 102 103 | 
             
                        node.source_range.with(
         | 
| 103 104 | 
             
                          end_pos: node.right_sibling.source_range.begin_pos
         | 
| 104 105 | 
             
                        )
         | 
| 106 | 
            +
                      else
         | 
| 107 | 
            +
                        # :nocov:
         | 
| 108 | 
            +
                        :noop
         | 
| 109 | 
            +
                        # :nocov:
         | 
| 105 110 | 
             
                      end
         | 
| 106 111 | 
             
                    end
         | 
| 112 | 
            +
                    # rubocop:enable Metrics/MethodLength
         | 
| 107 113 |  | 
| 108 114 | 
             
                    # @param [RuboCop::AST::PairNode] node
         | 
| 109 115 | 
             
                    # @return [RuboCop::AST::Node]
         | 
| @@ -39,7 +39,9 @@ module RuboCop | |
| 39 39 | 
             
                      attr_reader :expected, :actual, :failure_message
         | 
| 40 40 |  | 
| 41 41 | 
             
                      def self.minitest_assertion
         | 
| 42 | 
            +
                        # :nocov:
         | 
| 42 43 | 
             
                        raise NotImplementedError
         | 
| 44 | 
            +
                        # :nocov:
         | 
| 43 45 | 
             
                      end
         | 
| 44 46 |  | 
| 45 47 | 
             
                      def initialize(expected, actual, failure_message)
         | 
| @@ -62,7 +64,9 @@ module RuboCop | |
| 62 64 | 
             
                      end
         | 
| 63 65 |  | 
| 64 66 | 
             
                      def assertion
         | 
| 67 | 
            +
                        # :nocov:
         | 
| 65 68 | 
             
                        raise NotImplementedError
         | 
| 69 | 
            +
                        # :nocov:
         | 
| 66 70 | 
             
                      end
         | 
| 67 71 | 
             
                    end
         | 
| 68 72 |  | 
| @@ -64,6 +64,10 @@ module RuboCop | |
| 64 64 | 
             
                        be_invalid?(node)
         | 
| 65 65 | 
             
                      when :be_invalid
         | 
| 66 66 | 
             
                        not_to?(node)
         | 
| 67 | 
            +
                      else
         | 
| 68 | 
            +
                        # :nocov:
         | 
| 69 | 
            +
                        :noop
         | 
| 70 | 
            +
                        # :nocov:
         | 
| 67 71 | 
             
                      end
         | 
| 68 72 | 
             
                    end
         | 
| 69 73 |  | 
| @@ -81,6 +85,10 @@ module RuboCop | |
| 81 85 | 
             
                        'not_to'
         | 
| 82 86 | 
             
                      when :be_invalid
         | 
| 83 87 | 
             
                        'to'
         | 
| 88 | 
            +
                      else
         | 
| 89 | 
            +
                        # :nocov:
         | 
| 90 | 
            +
                        :noop
         | 
| 91 | 
            +
                        # :nocov:
         | 
| 84 92 | 
             
                      end
         | 
| 85 93 | 
             
                    end
         | 
| 86 94 |  | 
| @@ -90,6 +98,10 @@ module RuboCop | |
| 90 98 | 
             
                        'be_valid'
         | 
| 91 99 | 
             
                      when :be_invalid
         | 
| 92 100 | 
             
                        'be_invalid'
         | 
| 101 | 
            +
                      else
         | 
| 102 | 
            +
                        # :nocov:
         | 
| 103 | 
            +
                        :noop
         | 
| 104 | 
            +
                        # :nocov:
         | 
| 93 105 | 
             
                      end
         | 
| 94 106 | 
             
                    end
         | 
| 95 107 | 
             
                  end
         | 
| @@ -21,8 +21,14 @@ module RuboCop | |
| 21 21 | 
             
                  #     end
         | 
| 22 22 | 
             
                  #   end
         | 
| 23 23 | 
             
                  #
         | 
| 24 | 
            +
                  #   # bad
         | 
| 25 | 
            +
                  #   around do |example|
         | 
| 26 | 
            +
                  #     freeze_time(&example)
         | 
| 27 | 
            +
                  #   end
         | 
| 28 | 
            +
                  #
         | 
| 24 29 | 
             
                  #   # good
         | 
| 25 30 | 
             
                  #   before { freeze_time }
         | 
| 31 | 
            +
                  #
         | 
| 26 32 | 
             
                  class TravelAround < ::RuboCop::Cop::Base
         | 
| 27 33 | 
             
                    extend AutoCorrector
         | 
| 28 34 |  | 
| @@ -43,6 +49,13 @@ module RuboCop | |
| 43 49 | 
             
                      )
         | 
| 44 50 | 
             
                    PATTERN
         | 
| 45 51 |  | 
| 52 | 
            +
                    # @!method extract_travel_with_block_pass(node)
         | 
| 53 | 
            +
                    def_node_search :extract_travel_with_block_pass, <<~PATTERN
         | 
| 54 | 
            +
                      $(send _ TRAVEL_METHOD_NAMES
         | 
| 55 | 
            +
                        (block_pass $lvar)
         | 
| 56 | 
            +
                      )
         | 
| 57 | 
            +
                    PATTERN
         | 
| 58 | 
            +
             | 
| 46 59 | 
             
                    # @!method match_around_each?(node)
         | 
| 47 60 | 
             
                    def_node_matcher :match_around_each?, <<~PATTERN
         | 
| 48 61 | 
             
                      (block
         | 
| @@ -52,29 +65,39 @@ module RuboCop | |
| 52 65 | 
             
                    PATTERN
         | 
| 53 66 |  | 
| 54 67 | 
             
                    def on_block(node)
         | 
| 55 | 
            -
                       | 
| 56 | 
            -
             | 
| 68 | 
            +
                      extract_run_in_travel(node) do |run_node|
         | 
| 69 | 
            +
                        run_in_travel(node, run_node)
         | 
| 70 | 
            +
                      end
         | 
| 71 | 
            +
                      extract_travel_with_block_pass(node) do |travel_node, lvar|
         | 
| 72 | 
            +
                        travel_with_block_pass(travel_node, lvar)
         | 
| 73 | 
            +
                      end
         | 
| 74 | 
            +
                    end
         | 
| 75 | 
            +
                    alias on_numblock on_block
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                    private
         | 
| 57 78 |  | 
| 79 | 
            +
                    def run_in_travel(node, run_node)
         | 
| 58 80 | 
             
                      around_node = extract_surrounding_around_block(run_node)
         | 
| 59 81 | 
             
                      return unless around_node
         | 
| 60 82 |  | 
| 61 83 | 
             
                      add_offense(node) do |corrector|
         | 
| 62 | 
            -
                         | 
| 84 | 
            +
                        corrector.replace(node, node.body.source)
         | 
| 85 | 
            +
                        corrector.insert_before(around_node,
         | 
| 86 | 
            +
                                                "before { #{run_node.source} }\n\n")
         | 
| 63 87 | 
             
                      end
         | 
| 64 88 | 
             
                    end
         | 
| 65 | 
            -
                    alias on_numblock on_block
         | 
| 66 89 |  | 
| 67 | 
            -
                     | 
| 90 | 
            +
                    def travel_with_block_pass(node, lvar)
         | 
| 91 | 
            +
                      around_node = extract_surrounding_around_block(node)
         | 
| 92 | 
            +
                      return unless around_node
         | 
| 68 93 |  | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
                         | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
                        "before { #{run_node.source} }\n\n"
         | 
| 77 | 
            -
                      )
         | 
| 94 | 
            +
                      add_offense(node) do |corrector|
         | 
| 95 | 
            +
                        corrector.replace(node, "#{lvar.name}.run")
         | 
| 96 | 
            +
                        corrector.insert_before(
         | 
| 97 | 
            +
                          around_node,
         | 
| 98 | 
            +
                          "before { #{node.method_name} }\n\n"
         | 
| 99 | 
            +
                        )
         | 
| 100 | 
            +
                      end
         | 
| 78 101 | 
             
                    end
         | 
| 79 102 |  | 
| 80 103 | 
             
                    # @param node [RuboCop::AST::BlockNode]
         | 
| @@ -57,8 +57,8 @@ module RuboCop | |
| 57 57 | 
             
                    end
         | 
| 58 58 |  | 
| 59 59 | 
             
                    def cop_subclass?
         | 
| 60 | 
            -
                       | 
| 61 | 
            -
             | 
| 60 | 
            +
                      [RSPEC_RAILS_COP_CLASS_NAME,
         | 
| 61 | 
            +
                       RUBOCOP_COP_CLASS_NAME].include?(yardoc.superclass.path)
         | 
| 62 62 | 
             
                    end
         | 
| 63 63 |  | 
| 64 64 | 
             
                    def abstract?
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'lint_roller'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module RuboCop
         | 
| 6 | 
            +
              module RSpecRails
         | 
| 7 | 
            +
                # A plugin that integrates RuboCop RSpecRails with RuboCop's plugin system.
         | 
| 8 | 
            +
                class Plugin < LintRoller::Plugin
         | 
| 9 | 
            +
                  # :nocov:
         | 
| 10 | 
            +
                  def about
         | 
| 11 | 
            +
                    LintRoller::About.new(
         | 
| 12 | 
            +
                      name: 'rubocop-rspec_rails',
         | 
| 13 | 
            +
                      version: Version::STRING,
         | 
| 14 | 
            +
                      homepage: 'https://github.com/rubocop/rubocop-rspec_rails',
         | 
| 15 | 
            +
                      description: 'Code style checking for RSpec Rails files.'
         | 
| 16 | 
            +
                    )
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
                  # :nocov:
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  def supported?(context)
         | 
| 21 | 
            +
                    context.engine == :rubocop
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  def rules(_context)
         | 
| 25 | 
            +
                    project_root = Pathname.new(__dir__).join('../../..')
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                    LintRoller::Rules.new(
         | 
| 28 | 
            +
                      type: :path,
         | 
| 29 | 
            +
                      config_format: :rubocop,
         | 
| 30 | 
            +
                      value: project_root.join('config/default.yml')
         | 
| 31 | 
            +
                    )
         | 
| 32 | 
            +
                  end
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
            end
         | 
    
        data/lib/rubocop-rspec_rails.rb
    CHANGED
    
    | @@ -4,32 +4,10 @@ require 'pathname' | |
| 4 4 | 
             
            require 'yaml'
         | 
| 5 5 |  | 
| 6 6 | 
             
            require 'rubocop'
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            require 'rubocop/rspec/language/node_pattern'
         | 
| 9 | 
            -
             | 
| 10 7 | 
             
            require 'rubocop/rspec/language'
         | 
| 11 8 |  | 
| 9 | 
            +
            require_relative 'rubocop/rspec_rails/plugin'
         | 
| 12 10 | 
             
            require_relative 'rubocop/rspec_rails/version'
         | 
| 13 11 |  | 
| 14 12 | 
             
            require 'rubocop/cop/rspec/base'
         | 
| 15 13 | 
             
            require_relative 'rubocop/cop/rspec_rails_cops'
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            project_root = File.join(__dir__, '..')
         | 
| 18 | 
            -
            RuboCop::ConfigLoader.inject_defaults!(project_root)
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            # FIXME: This is a workaround for the following issue:
         | 
| 21 | 
            -
            # https://github.com/rubocop/rubocop-rspec_rails/issues/8
         | 
| 22 | 
            -
            module RuboCop
         | 
| 23 | 
            -
              module Cop
         | 
| 24 | 
            -
                class Registry # rubocop:disable Style/Documentation
         | 
| 25 | 
            -
                  prepend(Module.new do
         | 
| 26 | 
            -
                    def qualified_cop_name(name, path, warn: true)
         | 
| 27 | 
            -
                      return super unless name == 'RSpec/Rails/HttpStatus'
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                      badge = Badge.parse(name)
         | 
| 30 | 
            -
                      resolve_badge(badge, qualify_badge(badge).first, path)
         | 
| 31 | 
            -
                    end
         | 
| 32 | 
            -
                  end)
         | 
| 33 | 
            -
                end
         | 
| 34 | 
            -
              end
         | 
| 35 | 
            -
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,36 +1,68 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rubocop-rspec_rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.31.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Benjamin Quorning
         | 
| 8 8 | 
             
            - Phil Pirozhkov
         | 
| 9 9 | 
             
            - Maxim Krizhanovsky
         | 
| 10 10 | 
             
            - Yudai Takada
         | 
| 11 | 
            -
            autorequire: 
         | 
| 12 11 | 
             
            bindir: bin
         | 
| 13 12 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date:  | 
| 13 | 
            +
            date: 2025-03-10 00:00:00.000000000 Z
         | 
| 15 14 | 
             
            dependencies:
         | 
| 15 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 16 | 
            +
              name: lint_roller
         | 
| 17 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - "~>"
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: '1.1'
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                requirements:
         | 
| 26 | 
            +
                - - "~>"
         | 
| 27 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 28 | 
            +
                    version: '1.1'
         | 
| 16 29 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 30 | 
             
              name: rubocop
         | 
| 18 31 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 19 32 | 
             
                requirements:
         | 
| 20 33 | 
             
                - - "~>"
         | 
| 21 34 | 
             
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            -
                    version: '1. | 
| 35 | 
            +
                    version: '1.72'
         | 
| 36 | 
            +
                - - ">="
         | 
| 37 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 38 | 
            +
                    version: 1.72.1
         | 
| 39 | 
            +
              type: :runtime
         | 
| 40 | 
            +
              prerelease: false
         | 
| 41 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - "~>"
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            +
                    version: '1.72'
         | 
| 46 | 
            +
                - - ">="
         | 
| 47 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 48 | 
            +
                    version: 1.72.1
         | 
| 49 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 50 | 
            +
              name: rubocop-rspec
         | 
| 51 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 52 | 
            +
                requirements:
         | 
| 53 | 
            +
                - - "~>"
         | 
| 54 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 55 | 
            +
                    version: '3.5'
         | 
| 23 56 | 
             
              type: :runtime
         | 
| 24 57 | 
             
              prerelease: false
         | 
| 25 58 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 26 59 | 
             
                requirements:
         | 
| 27 60 | 
             
                - - "~>"
         | 
| 28 61 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version: ' | 
| 62 | 
            +
                    version: '3.5'
         | 
| 30 63 | 
             
            description: |
         | 
| 31 64 | 
             
              Code style checking for RSpec Rails files.
         | 
| 32 65 | 
             
              A plugin for the RuboCop code style enforcing & linting tool.
         | 
| 33 | 
            -
            email: 
         | 
| 34 66 | 
             
            executables: []
         | 
| 35 67 | 
             
            extensions: []
         | 
| 36 68 | 
             
            extra_rdoc_files:
         | 
| @@ -54,6 +86,7 @@ files: | |
| 54 86 | 
             
            - lib/rubocop/rspec_rails/config_formatter.rb
         | 
| 55 87 | 
             
            - lib/rubocop/rspec_rails/cop/generator.rb
         | 
| 56 88 | 
             
            - lib/rubocop/rspec_rails/description_extractor.rb
         | 
| 89 | 
            +
            - lib/rubocop/rspec_rails/plugin.rb
         | 
| 57 90 | 
             
            - lib/rubocop/rspec_rails/version.rb
         | 
| 58 91 | 
             
            homepage: https://github.com/rubocop/rubocop-rspec_rails
         | 
| 59 92 | 
             
            licenses:
         | 
| @@ -62,7 +95,7 @@ metadata: | |
| 62 95 | 
             
              changelog_uri: https://github.com/rubocop/rubocop-rspec_rails/blob/master/CHANGELOG.md
         | 
| 63 96 | 
             
              documentation_uri: https://docs.rubocop.org/rubocop-rspec_rails/
         | 
| 64 97 | 
             
              rubygems_mfa_required: 'true'
         | 
| 65 | 
            -
             | 
| 98 | 
            +
              default_lint_roller_plugin: RuboCop::RSpecRails::Plugin
         | 
| 66 99 | 
             
            rdoc_options: []
         | 
| 67 100 | 
             
            require_paths:
         | 
| 68 101 | 
             
            - lib
         | 
| @@ -77,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 77 110 | 
             
                - !ruby/object:Gem::Version
         | 
| 78 111 | 
             
                  version: '0'
         | 
| 79 112 | 
             
            requirements: []
         | 
| 80 | 
            -
            rubygems_version: 3. | 
| 81 | 
            -
            signing_key: 
         | 
| 113 | 
            +
            rubygems_version: 3.6.2
         | 
| 82 114 | 
             
            specification_version: 4
         | 
| 83 115 | 
             
            summary: Code style checking for RSpec Rails files
         | 
| 84 116 | 
             
            test_files: []
         |