mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-25 05:13:40 +01:00
Reduce expectations for RSpec/MultipleExpectations
cop in controllers/statuses
spec (#27875)
This commit is contained in:
parent
669a7157cb
commit
c1f93def40
1 changed files with 134 additions and 87 deletions
|
@ -57,11 +57,14 @@ describe StatusesController do
|
||||||
let(:format) { 'html' }
|
let(:format) { 'html' }
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:show)
|
||||||
expect(response.headers['Cache-Control']).to include 'public'
|
expect(response.headers).to include(
|
||||||
expect(response).to render_template(:show)
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('public'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -72,12 +75,15 @@ describe StatusesController do
|
||||||
it_behaves_like 'cacheable response', expects_vary: 'Accept, Accept-Language, Cookie'
|
it_behaves_like 'cacheable response', expects_vary: 'Accept, Accept-Language, Cookie'
|
||||||
|
|
||||||
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
expect(response.headers).to include(
|
||||||
expect(response.headers['Content-Type']).to include 'application/activity+json'
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
json = body_as_json
|
'Content-Type' => include('application/activity+json'),
|
||||||
expect(json[:content]).to include status.text
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
|
expect(body_as_json)
|
||||||
|
.to include(content: include(status.text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -157,11 +163,14 @@ describe StatusesController do
|
||||||
let(:format) { 'html' }
|
let(:format) { 'html' }
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:show)
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
expect(response.headers).to include(
|
||||||
expect(response).to render_template(:show)
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('private'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -170,13 +179,16 @@ describe StatusesController do
|
||||||
let(:format) { 'json' }
|
let(:format) { 'json' }
|
||||||
|
|
||||||
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
expect(response.headers).to include(
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
expect(response.headers['Content-Type']).to include 'application/activity+json'
|
'Cache-Control' => include('private'),
|
||||||
json = body_as_json
|
'Content-Type' => include('application/activity+json'),
|
||||||
expect(json[:content]).to include status.text
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
|
expect(body_as_json)
|
||||||
|
.to include(content: include(status.text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -194,11 +206,15 @@ describe StatusesController do
|
||||||
let(:format) { 'html' }
|
let(:format) { 'html' }
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:show)
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
|
||||||
expect(response).to render_template(:show)
|
expect(response.headers).to include(
|
||||||
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('private'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -207,13 +223,16 @@ describe StatusesController do
|
||||||
let(:format) { 'json' }
|
let(:format) { 'json' }
|
||||||
|
|
||||||
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
expect(response.headers).to include(
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
expect(response.headers['Content-Type']).to include 'application/activity+json'
|
'Cache-Control' => include('private'),
|
||||||
json = body_as_json
|
'Content-Type' => include('application/activity+json'),
|
||||||
expect(json[:content]).to include status.text
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
|
expect(body_as_json)
|
||||||
|
.to include(content: include(status.text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -254,11 +273,14 @@ describe StatusesController do
|
||||||
let(:format) { 'html' }
|
let(:format) { 'html' }
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:show)
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
expect(response.headers).to include(
|
||||||
expect(response).to render_template(:show)
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('private'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -267,13 +289,16 @@ describe StatusesController do
|
||||||
let(:format) { 'json' }
|
let(:format) { 'json' }
|
||||||
|
|
||||||
it 'renders ActivityPub Note object successfully' do
|
it 'renders ActivityPub Note object successfully' do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
expect(response.headers).to include(
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
expect(response.headers['Content-Type']).to include 'application/activity+json'
|
'Cache-Control' => include('private'),
|
||||||
json = body_as_json
|
'Content-Type' => include('application/activity+json'),
|
||||||
expect(json[:content]).to include status.text
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
|
expect(body_as_json)
|
||||||
|
.to include(content: include(status.text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -340,11 +365,14 @@ describe StatusesController do
|
||||||
let(:format) { 'html' }
|
let(:format) { 'html' }
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:show)
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
expect(response.headers).to include(
|
||||||
expect(response).to render_template(:show)
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('private'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -355,12 +383,15 @@ describe StatusesController do
|
||||||
it_behaves_like 'cacheable response', expects_vary: 'Accept, Accept-Language, Cookie'
|
it_behaves_like 'cacheable response', expects_vary: 'Accept, Accept-Language, Cookie'
|
||||||
|
|
||||||
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
it 'renders ActivityPub Note object successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
expect(response.headers).to include(
|
||||||
expect(response.headers['Content-Type']).to include 'application/activity+json'
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
json = body_as_json
|
'Content-Type' => include('application/activity+json'),
|
||||||
expect(json[:content]).to include status.text
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
|
expect(body_as_json)
|
||||||
|
.to include(content: include(status.text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -378,11 +409,14 @@ describe StatusesController do
|
||||||
let(:format) { 'html' }
|
let(:format) { 'html' }
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:show)
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
expect(response.headers).to include(
|
||||||
expect(response).to render_template(:show)
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('private'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -391,13 +425,17 @@ describe StatusesController do
|
||||||
let(:format) { 'json' }
|
let(:format) { 'json' }
|
||||||
|
|
||||||
it 'renders ActivityPub Note object successfully' do
|
it 'renders ActivityPub Note object successfully' do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
expect(response.headers).to include(
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
expect(response.headers['Content-Type']).to include 'application/activity+json'
|
'Cache-Control' => include('private'),
|
||||||
json = body_as_json
|
'Content-Type' => include('application/activity+json'),
|
||||||
expect(json[:content]).to include status.text
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(body_as_json)
|
||||||
|
.to include(content: include(status.text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -438,11 +476,14 @@ describe StatusesController do
|
||||||
let(:format) { 'html' }
|
let(:format) { 'html' }
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:show)
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
expect(response.headers).to include(
|
||||||
expect(response).to render_template(:show)
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('private'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -451,13 +492,16 @@ describe StatusesController do
|
||||||
let(:format) { 'json' }
|
let(:format) { 'json' }
|
||||||
|
|
||||||
it 'renders ActivityPub Note object', :aggregate_failures do
|
it 'renders ActivityPub Note object', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
expect(response.headers).to include(
|
||||||
expect(response.headers['Cache-Control']).to include 'private'
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
expect(response.headers['Content-Type']).to include 'application/activity+json'
|
'Cache-Control' => include('private'),
|
||||||
json = body_as_json
|
'Content-Type' => include('application/activity+json'),
|
||||||
expect(json[:content]).to include status.text
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
|
expect(body_as_json)
|
||||||
|
.to include(content: include(status.text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -732,11 +776,14 @@ describe StatusesController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders status successfully', :aggregate_failures do
|
it 'renders status successfully', :aggregate_failures do
|
||||||
expect(response).to have_http_status(200)
|
expect(response)
|
||||||
expect(response.headers['Link'].to_s).to include 'activity+json'
|
.to have_http_status(200)
|
||||||
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
|
.and render_template(:embed)
|
||||||
expect(response.headers['Cache-Control']).to include 'public'
|
expect(response.headers).to include(
|
||||||
expect(response).to render_template(:embed)
|
'Vary' => 'Accept, Accept-Language, Cookie',
|
||||||
|
'Cache-Control' => include('public'),
|
||||||
|
'Link' => satisfy { |header| header.to_s.include?('activity+json') }
|
||||||
|
)
|
||||||
expect(response.body).to include status.text
|
expect(response.body).to include status.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue