Skip to content

Commit

Permalink
Define respond to missing on Mock
Browse files Browse the repository at this point in the history
Fixes freerange#322.

As of Ruby 2.4, using Forwardable to delegate to a missing method,
without defining respond_to_missing? on the receiver, results in
depecration warnings being shown.

Define respond_to_missing? in place of respond_to? on Mocha::Mock so
that deprecation warnings are no longer shown.
  • Loading branch information
tjvc committed Feb 12, 2018
1 parent 76aad9c commit 3f836d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mocha/mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def method_missing(symbol, *arguments, &block)
end

# @private
def respond_to?(symbol, include_private = false)
def respond_to_missing?(symbol, include_private = false)
if @responder then
if @responder.method(:respond_to?).arity > 1
@responder.respond_to?(symbol, include_private)
Expand Down

0 comments on commit 3f836d7

Please sign in to comment.