Created
May 24, 2012 12:53
-
-
Save rodrigomaia/2781396 to your computer and use it in GitHub Desktop.
[RSpec] How to get instance that was invoked a stub method on any_instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ANYCLASS.any_instance.stub(:METHOD) do |METHOD_PARAM| | |
INSTANCE_ANYCLASS = ANYCLASS.__recorder.instance_that_received(:METHOD) | |
end | |
# See docs: | |
# AnyInstance => http://rubydoc.info/github/rspec/rspec-mocks/RSpec/Mocks/AnyInstance | |
# Recorder => http://rubydoc.info/github/rspec/rspec-mocks/RSpec/Mocks/AnyInstance/Recorder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment