sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Mocha::Mock#responds_like_instance_of

Constrains the {Mock} instance so that it can only expect or stub methods to which an instance of the +responder_class+ responds. The constraint is only applied at method invocation time. Note that the responder instance is instantiated using +Class#allocate+.

A +NoMethodError+ will be raised if the responder instance does not +#respond_to?+ a method invocation (even if the method has been expected or stubbed).

The {Mock} instance will delegate its +#respond_to?+ method to the responder instance.

Note that the methods on the responder instance are never actually invoked.

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/mocha-1.1.0/lib/mocha/mock.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Mocha--Mock-responds_like_instance_of-for-pr


# Commit to git

git add app/server/ruby/vendor/mocha-1.1.0/lib/mocha/mock.rbgit commit -m "better docs for Mocha::Mock#responds_like_instance_of"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Mocha--Mock-responds_like_instance_of-for-pr

hub pull-request


# Celebrate!