class BaconExpect::Matcher::RespondTo

Public Class Methods

new(method_name) click to toggle source
# File lib/bacon-expect/matchers/respond_to.rb, line 3
def initialize(method_name)
  @method_name = method_name
end

Public Instance Methods

argument()
Alias for: arguments
arguments() click to toggle source
# File lib/bacon-expect/matchers/respond_to.rb, line 12
def arguments
  self
end
Also aliased as: argument
fail!(subject, negated) click to toggle source
# File lib/bacon-expect/matchers/respond_to.rb, line 24
def fail!(subject, negated)
  raise FailedExpectation.new(FailMessageRenderer.message_for_respond_to(negated, subject, @method_name, @number_of_args))
end
matches?(subject) click to toggle source
# File lib/bacon-expect/matchers/respond_to.rb, line 17
def matches?(subject)
  valid = true
  valid &&= subject.respond_to?(@method_name)
  valid &&= subject.method(@method_name).arity == @number_of_args if valid && @number_of_args
  valid
end
with(number_of_args) click to toggle source
# File lib/bacon-expect/matchers/respond_to.rb, line 7
def with(number_of_args)
  @number_of_args = number_of_args
  self
end