FEATURE: remove bookmark button in activity feed

This commit is contained in:
Régis Hanol
2014-05-09 17:49:39 +02:00
parent 9125453628
commit bc3de84ebf
15 changed files with 110 additions and 40 deletions

View File

@@ -288,9 +288,13 @@ describe PostsController do
let(:post) { Fabricate(:post, user: log_in) }
it "raises an error if the user doesn't have permission to see the post" do
Guardian.any_instance.expects(:can_see?).with(post).returns(false)
Guardian.any_instance.expects(:can_see?).with(post).returns(false).twice
xhr :put, :bookmark, post_id: post.id, bookmarked: 'true'
response.should be_forbidden
xhr :put, :remove_bookmark_by_number, topic_id: post.topic_id, post_number: post.post_number
response.should be_forbidden
end
it 'creates a bookmark' do
@@ -303,6 +307,11 @@ describe PostsController do
xhr :put, :bookmark, post_id: post.id
end
it 'removes a bookmark using the topic_id and the post_number' do
PostAction.expects(:remove_act).with(post.user, post, PostActionType.types[:bookmark])
xhr :put, :remove_bookmark_by_number, topic_id: post.topic_id, post_number: post.post_number
end
end
end