Object
# File lib/rspec/matchers/built_in/respond_to.rb, line 35 35: def argument 36: self 37: end
# File lib/rspec/matchers/built_in/respond_to.rb, line 26 26: def description 27: "respond to #{pp_names}#{with_arity}" 28: end
# File lib/rspec/matchers/built_in/respond_to.rb, line 14 14: def does_not_match?(actual) 15: find_failing_method_names(actual, :select).empty? 16: end
# File lib/rspec/matchers/built_in/respond_to.rb, line 18 18: def failure_message_for_should 19: "expected #{@actual.inspect} to respond to #{@failing_method_names.collect {|name| name.inspect }.join(', ')}#{with_arity}" 20: end
# File lib/rspec/matchers/built_in/respond_to.rb, line 22 22: def failure_message_for_should_not 23: failure_message_for_should.sub(/to respond to/, 'not to respond to') 24: end
# File lib/rspec/matchers/built_in/respond_to.rb, line 42 42: def find_failing_method_names(actual, filter_method) 43: @actual = actual 44: @failing_method_names = @names.send(filter_method) do |name| 45: @actual.respond_to?(name) && matches_arity?(actual, name) 46: end 47: end
# File lib/rspec/matchers/built_in/respond_to.rb, line 49 49: def matches_arity?(actual, name) 50: return true unless @expected_arity 51: 52: actual_arity = actual.method(name).arity 53: if actual_arity < 0 54: # ~ inverts the one's complement and gives us the number of required args 55: ~actual_arity <= @expected_arity 56: else 57: actual_arity == @expected_arity 58: end 59: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.