Sha256: e5cd92eb939baac227ea7f05c9a09b997200debc86ef23ca099681d1e87dfce8

Contents?: true

Size: 825 Bytes

Versions: 7

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      # Checks that the first argument to an example group is not empty.
      #
      # @example
      #   # bad
      #   describe do
      #   end
      #
      #   RSpec.describe do
      #   end
      #
      #   # good
      #   describe TestedClass do
      #   end
      #
      #   describe "A feature example" do
      #   end
      class MissingExampleGroupArgument < Cop
        MSG = 'The first argument to `%<method>s` should not be empty.'.freeze

        def on_block(node)
          return unless example_group?(node)
          return if node.send_node.arguments?

          add_offense(node, location: :expression,
                            message: format(MSG, method: node.method_name))
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubocop-rspec-1.32.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-1.31.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-1.30.1 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-1.30.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-1.29.1 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-1.29.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-1.28.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb