PostDestroyer to replace callbacks for destroying

This commit is contained in:
Robin Ward
2013-03-18 17:52:29 -04:00
parent c1e40f5d19
commit 59fc3bfac4
9 changed files with 93 additions and 65 deletions

View File

@ -85,8 +85,10 @@ describe PostsController do
response.should be_forbidden
end
it "calls delete_by" do
Post.any_instance.expects(:delete_by).with(user)
it "uses a PostDestroyer" do
destroyer = mock
PostDestroyer.expects(:new).with(user, post).returns(destroyer)
destroyer.expects(:destroy)
xhr :delete, :destroy, id: post.id
end