Sha256: f069a833c19b1385226bd155b9ed5066e91265627605163823c1ffa5bd3621e5

Contents?: true

Size: 770 Bytes

Versions: 14

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Minitest
      # This cop enforces the test to use `refute_respond_to(object, :do_something)`
      # over `refute(object.respond_to?(:do_something))`.
      #
      # @example
      #   # bad
      #   refute(object.respond_to?(:do_something))
      #   refute(object.respond_to?(:do_something), 'message')
      #   refute(respond_to?(:do_something))
      #
      #   # good
      #   refute_respond_to(object, :do_something)
      #   refute_respond_to(object, :do_something, 'message')
      #   refute_respond_to(self, :do_something)
      #
      class RefuteRespondTo < Base
        extend MinitestCopRule

        define_rule :refute, target_method: :respond_to?
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rubocop-minitest-0.19.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.19.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.18.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.17.2 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.17.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.17.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.16.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.15.2 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.15.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.15.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.14.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.13.0 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.12.1 lib/rubocop/cop/minitest/refute_respond_to.rb
rubocop-minitest-0.12.0 lib/rubocop/cop/minitest/refute_respond_to.rb