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

View File

@ -485,6 +485,16 @@ describe Guardian do
Guardian.new(post.user).can_edit?(post).should be_true
end
it 'returns false if you are trying to edit a post you soft deleted' do
post.user_deleted = true
Guardian.new(post.user).can_edit?(post).should be_false
end
it 'returns false if you are trying to edit a deleted post' do
post.deleted_at = 1.day.ago
Guardian.new(post.user).can_edit?(post).should be_false
end
it 'returns false if another regular user tries to edit your post' do
Guardian.new(coding_horror).can_edit?(post).should be_false
end