Last active
December 10, 2015 03:48
-
-
Save tatey/4376776 to your computer and use it in GitHub Desktop.
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
| # Person has a polymorphic relationship called contactable. | |
| # We want the person's contactable method to return a contact | |
| # of our choosing. | |
| contact = Contact.new | |
| real_person = Person.find(1) | |
| mock_person = SimpleMock.new(real_person) | |
| mock_person.expect(:contactable, contact) | |
| mock_person.contact == contact # => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment