0
0
Fork 0

Extract authorization policy for viewing statuses (#3150)

This commit is contained in:
Jack Jennings 2017-05-29 09:22:22 -07:00 committed by Eugen Rochko
parent 9a81be0d37
commit 3a2003ba86
16 changed files with 155 additions and 80 deletions

View file

@ -30,7 +30,7 @@ describe MediaController do
it 'raises when not permitted to view' do
status = Fabricate(:status)
media_attachment = Fabricate(:media_attachment, status: status)
allow_any_instance_of(Status).to receive(:permitted?).and_return(false)
allow_any_instance_of(MediaController).to receive(:authorize).and_raise(ActiveRecord::RecordNotFound)
get :show, params: { id: media_attachment.to_param }
expect(response).to have_http_status(:missing)