Sha256: 97145c3ac33ce9ef0b9fbb24fe718c57ff3fcd16e945f3ef5a1e6cd82ae27a03
Contents?: true
Size: 906 Bytes
Versions: 8
Compression:
Stored size: 906 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 include RuboCop::RSpec::Util 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
8 entries across 8 versions & 1 rubygems