Sha256: 20c87d495a498df11d00c3befc22d09b70290e2dc3bb868cc24f12363651f068
Contents?: true
Size: 869 Bytes
Versions: 4
Compression:
Stored size: 869 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Checks that the second argument to `describe` specifies a method. # # @example # # bad # describe MyClass, 'do something' do # end # # # good # describe MyClass, '#my_instance_method' do # end # # describe MyClass, '.my_class_method' do # end class DescribeMethod < Cop include RuboCop::RSpec::TopLevelDescribe MSG = 'The second argument to describe should be the method '\ "being tested. '#instance' or '.class'." def on_top_level_describe(_node, (_, second_arg)) return unless second_arg&.str_type? return if second_arg.str_content.start_with?('#', '.') add_offense(second_arg) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems