Skip to content

Commit

Permalink
Remove double subject call in api/v1/admin/trends/links/links spec (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski authored Jan 11, 2024
1 parent 95bd46d commit 2954279
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions spec/requests/api/v1/admin/trends/links/links_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
it_behaves_like 'forbidden for wrong role', ''

it 'returns http success' do
subject
expect { subject }
.to change_link_trendable_to_true

expect(response).to have_http_status(200)
expects_correct_link_data
end

it 'sets the link as trendable' do
expect { subject }.to change { preview_card.reload.trendable }.from(false).to(true)
def change_link_trendable_to_true
change { preview_card.reload.trendable }.from(false).to(true)
end

it 'returns the link data' do
subject

def expects_correct_link_data
expect(body_as_json).to match(
a_hash_including(
url: preview_card.url,
Expand Down Expand Up @@ -85,13 +85,14 @@
it_behaves_like 'forbidden for wrong role', ''

it 'returns http success' do
subject
expect { subject }
.to_not change_link_trendable

expect(response).to have_http_status(200)
end

it 'does not set the link as trendable' do
expect { subject }.to_not(change { preview_card.reload.trendable })
def change_link_trendable
change { preview_card.reload.trendable }
end

it 'returns the link data' do
Expand Down

0 comments on commit 2954279

Please sign in to comment.