Created
August 5, 2014 15:31
-
-
Save lukeredpath/cae3033ef0c754937b69 to your computer and use it in GitHub Desktop.
Rspec mock argument capture
This file contains hidden or 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
# just an example of what it could be | |
argument = capture('label') | |
widget = double | |
# argument acts like an argument matcher that always matches but stores a reference to the real value | |
allow(widget).to receive(:do_something).with(argument) | |
# contrived, I know this could be done using the instance_of argument matcher | |
expect(argument.value).to be_instance_of(Something) |
gbirchmeier
commented
Apr 12, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment