Remove double subject call in `api/v1/admin/trends/links/links` spec (#28695)

shrike
Matt Jankowski 2024-01-11 10:13:11 -05:00 committed by GitHub
parent 95bd46d32a
commit 2954279e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -32,18 +32,18 @@ describe 'Links' do
it_behaves_like 'forbidden for wrong role', '' it_behaves_like 'forbidden for wrong role', ''
it 'returns http success' do it 'returns http success' do
subject expect { subject }
.to change_link_trendable_to_true
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expects_correct_link_data
end end
it 'sets the link as trendable' do def change_link_trendable_to_true
expect { subject }.to change { preview_card.reload.trendable }.from(false).to(true) change { preview_card.reload.trendable }.from(false).to(true)
end end
it 'returns the link data' do def expects_correct_link_data
subject
expect(body_as_json).to match( expect(body_as_json).to match(
a_hash_including( a_hash_including(
url: preview_card.url, url: preview_card.url,
@ -85,13 +85,14 @@ describe 'Links' do
it_behaves_like 'forbidden for wrong role', '' it_behaves_like 'forbidden for wrong role', ''
it 'returns http success' do it 'returns http success' do
subject expect { subject }
.to_not change_link_trendable
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
it 'does not set the link as trendable' do def change_link_trendable
expect { subject }.to_not(change { preview_card.reload.trendable }) change { preview_card.reload.trendable }
end end
it 'returns the link data' do it 'returns the link data' do