allow end user to recover a post they delete

automatically delete stubs after 1 day
This commit is contained in:
Sam 2013-07-22 17:48:24 +10:00
parent d68f30c09d
commit 1f3c5cb656
13 changed files with 131 additions and 23 deletions
spec/controllers

View file

@ -124,10 +124,14 @@ describe PostsController do
response.should be_forbidden
end
it "calls recover and updates the topic's statistics" do
Post.any_instance.expects(:recover!)
Topic.any_instance.expects(:update_statistics)
it "recovers a post correctly" do
topic_id = create_post.topic_id
post = create_post(topic_id: topic_id)
PostDestroyer.new(user, post).destroy
xhr :put, :recover, post_id: post.id
post.reload
post.deleted_at.should == nil
end
end