Skip to content

Instantly share code, notes, and snippets.

@peter
Created February 24, 2010 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peter/313583 to your computer and use it in GitHub Desktop.
Save peter/313583 to your computer and use it in GitHub Desktop.
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