class MotionSpec::Matcher::RespondTo
Public Class Methods
new(method_name)
click to toggle source
# File lib/motion-spec/matcher/respond_to.rb, line 4 def initialize(method_name) @method_name = method_name end
Public Instance Methods
arguments()
click to toggle source
# File lib/motion-spec/matcher/respond_to.rb, line 13 def arguments self end
Also aliased as: argument
fail!(subject, negated)
click to toggle source
# File lib/motion-spec/matcher/respond_to.rb, line 30 def fail!(subject, negated) fail FailedExpectation.new( FailMessageRenderer.message_for_respond_to( negated, subject, @method_name, @number_of_args ) ) end
matches?(subject)
click to toggle source
# File lib/motion-spec/matcher/respond_to.rb, line 18 def matches?(subject) valid = true valid &&= subject.respond_to?(@method_name) if valid && @number_of_args valid &&= subject.method(@method_name).arity == @number_of_args end valid end
with(number_of_args)
click to toggle source
# File lib/motion-spec/matcher/respond_to.rb, line 8 def with(number_of_args) @number_of_args = number_of_args self end