Sha256: 675cc71e68147a14246e784a4afbc0c7007d9c5ad6dfa98de39e696f46e33cf3

Contents?: true

Size: 725 Bytes

Versions: 9

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      # Avoid describing symbols.
      #
      # @example
      #   # bad
      #   describe :my_method do
      #     # ...
      #   end
      #
      #   # good
      #   describe '#my_method' do
      #     # ...
      #   end
      #
      # @see https://github.com/rspec/rspec-core/issues/1610
      class DescribeSymbol < Base
        MSG = 'Avoid describing symbols.'

        def_node_matcher :describe_symbol?, <<-PATTERN
          (send #rspec? :describe $sym ...)
        PATTERN

        def on_send(node)
          describe_symbol?(node) do |match|
            add_offense(match)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubocop-rspec-2.1.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-2.0.1 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-2.0.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-2.0.0.pre lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.44.1 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.44.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.43.2 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.43.1 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.43.0 lib/rubocop/cop/rspec/describe_symbol.rb