Created
February 24, 2010 16:32
-
-
Save peter/313583 to your computer and use it in GitHub Desktop.
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
describe "Mocking/Stubbing Associations with RSpec" do | |
it "can be done with proxy_target" do | |
# Suppose the Article model has an after_save callback that invokes notify_change on the author | |
# if the article has been changed. | |
@article.author.proxy_target.should_receive(:notify_change) | |
@article.update_attributes(:body => "new body") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment