Merge branch 'stable' into develop

This commit is contained in:
Jonne Haß 2015-11-04 22:10:07 +01:00
commit 7fca5cf93a
2 changed files with 14 additions and 0 deletions

View file

@ -21,6 +21,10 @@ class PostsController < ApplicationController
end
end
rescue_from Diaspora::NotMine do
render text: "You are not allowed to do that", status: 403
end
def show
post_service = PostService.new(id: params[:id], user: current_user)
post_service.mark_user_notifications

View file

@ -135,5 +135,15 @@ describe PostsController, type: :controller do
message = alice.post(:status_message, text: "hey", to: alice.aspects.first.id)
delete :destroy, format: :js, id: message.id
end
context "when Diaspora::NotMine is raised by retract post" do
it "will respond with a 403" do
expect(post_service_double).to receive(:retract_post).and_raise(Diaspora::NotMine)
message = alice.post(:status_message, text: "hey", to: alice.aspects.first.id)
delete :destroy, format: :js, id: message.id
expect(response.body).to eq("You are not allowed to do that")
expect(response.status).to eq(403)
end
end
end
end