class TestBelt::Matchers::HaveInstanceMethods::Matcher

Public Class Methods

new(method) click to toggle source
# File lib/test_belt/matchers/have_instance_methods.rb, line 18
def initialize(method)
  unless method.kind_of?(::String) || method.kind_of?(::Symbol)
    raise ArgumentError, "please specify the method name using a string or symbol"
  end
  @method = method
end

Public Instance Methods

desc() click to toggle source
# File lib/test_belt/matchers/have_instance_methods.rb, line 25
def desc
  "respond to #{method_type} ##{@method}"
end
method_type() click to toggle source
# File lib/test_belt/matchers/have_instance_methods.rb, line 35
def method_type
  "instance method"
end
test() click to toggle source
# File lib/test_belt/matchers/have_instance_methods.rb, line 29
def test
  using(@method) do |method|
    assert subject.respond_to?(method, true), "#{subject.class.name} does not have instance method ##{method}"
  end
end