|
|
@ -4,12 +4,7 @@ require 'rails_helper'
|
|
|
|
|
|
|
|
|
|
|
|
describe 'Media Proxy' do
|
|
|
|
describe 'Media Proxy' do
|
|
|
|
describe 'GET /media_proxy/:id' do
|
|
|
|
describe 'GET /media_proxy/:id' do
|
|
|
|
before do
|
|
|
|
before { stub_attachment_request }
|
|
|
|
integration_session.https! # TODO: Move to global rails_helper for all request specs?
|
|
|
|
|
|
|
|
host! Rails.configuration.x.local_domain # TODO: Move to global rails_helper for all request specs?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stub_request(:get, 'http://example.com/attachment.png').to_return(request_fixture('avatar.txt'))
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context 'when attached to a status' do
|
|
|
|
context 'when attached to a status' do
|
|
|
|
let(:status) { Fabricate(:status) }
|
|
|
|
let(:status) { Fabricate(:status) }
|
|
|
@ -63,5 +58,15 @@ describe 'Media Proxy' do
|
|
|
|
.to have_http_status(404)
|
|
|
|
.to have_http_status(404)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def stub_attachment_request
|
|
|
|
|
|
|
|
stub_request(
|
|
|
|
|
|
|
|
:get,
|
|
|
|
|
|
|
|
'http://example.com/attachment.png'
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.to_return(
|
|
|
|
|
|
|
|
request_fixture('avatar.txt')
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|