|
|
|
@ -9,93 +9,6 @@ RSpec.describe StatusesController do
|
|
|
|
|
let(:account) { Fabricate(:account) }
|
|
|
|
|
let(:status) { Fabricate(:status, account: account) }
|
|
|
|
|
|
|
|
|
|
context 'when status is public' do
|
|
|
|
|
before do
|
|
|
|
|
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with HTML' do
|
|
|
|
|
let(:format) { 'html' }
|
|
|
|
|
|
|
|
|
|
it 'renders status successfully', :aggregate_failures do
|
|
|
|
|
expect(response)
|
|
|
|
|
.to have_http_status(200)
|
|
|
|
|
.and render_template(:show)
|
|
|
|
|
expect(response.headers).to include(
|
|
|
|
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
|
|
|
|
'Cache-Control' => include('public'),
|
|
|
|
|
'Link' => include('activity+json')
|
|
|
|
|
)
|
|
|
|
|
expect(response.body).to include status.text
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with JSON' do
|
|
|
|
|
let(:format) { 'json' }
|
|
|
|
|
|
|
|
|
|
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
|
|
|
|
expect(response)
|
|
|
|
|
.to have_http_status(200)
|
|
|
|
|
.and have_cacheable_headers.with_vary('Accept, Accept-Language, Cookie')
|
|
|
|
|
|
|
|
|
|
expect(response.headers).to include(
|
|
|
|
|
'Content-Type' => include('application/activity+json'),
|
|
|
|
|
'Link' => include('activity+json')
|
|
|
|
|
)
|
|
|
|
|
expect(response.parsed_body)
|
|
|
|
|
.to include(content: include(status.text))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when status is private' do
|
|
|
|
|
let(:status) { Fabricate(:status, account: account, visibility: :private) }
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with JSON' do
|
|
|
|
|
let(:format) { 'json' }
|
|
|
|
|
|
|
|
|
|
it 'returns http not found' do
|
|
|
|
|
expect(response).to have_http_status(404)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with HTML' do
|
|
|
|
|
let(:format) { 'html' }
|
|
|
|
|
|
|
|
|
|
it 'returns http not found' do
|
|
|
|
|
expect(response).to have_http_status(404)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when status is direct' do
|
|
|
|
|
let(:status) { Fabricate(:status, account: account, visibility: :direct) }
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
get :show, params: { account_username: status.account.username, id: status.id, format: format }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with JSON' do
|
|
|
|
|
let(:format) { 'json' }
|
|
|
|
|
|
|
|
|
|
it 'returns http not found' do
|
|
|
|
|
expect(response).to have_http_status(404)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with HTML' do
|
|
|
|
|
let(:format) { 'html' }
|
|
|
|
|
|
|
|
|
|
it 'returns http not found' do
|
|
|
|
|
expect(response).to have_http_status(404)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when signed-in' do
|
|
|
|
|
let(:user) { Fabricate(:user) }
|
|
|
|
|
|
|
|
|
|