From 95bd46d32afaaccc78762f7fc9c6428c4880cbc0 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 11 Jan 2024 10:11:57 -0500 Subject: [PATCH] Remove double subject call in `api/v1/admin/ip_blocks` spec (#28696) --- spec/requests/api/v1/admin/ip_blocks_spec.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/requests/api/v1/admin/ip_blocks_spec.rb b/spec/requests/api/v1/admin/ip_blocks_spec.rb index fbcb39e3bef..98b954dd49f 100644 --- a/spec/requests/api/v1/admin/ip_blocks_spec.rb +++ b/spec/requests/api/v1/admin/ip_blocks_spec.rb @@ -177,7 +177,9 @@ RSpec.describe 'IP Blocks' do let(:params) { { severity: 'sign_up_requires_approval', comment: 'Decreasing severity' } } it 'returns the correct ip block', :aggregate_failures do - subject + expect { subject } + .to change_severity_level + .and change_comment_value expect(response).to have_http_status(200) expect(body_as_json).to match(hash_including({ @@ -187,12 +189,12 @@ RSpec.describe 'IP Blocks' do })) end - it 'updates the severity correctly' do - expect { subject }.to change { ip_block.reload.severity }.from('no_access').to('sign_up_requires_approval') + def change_severity_level + change { ip_block.reload.severity }.from('no_access').to('sign_up_requires_approval') end - it 'updates the comment correctly' do - expect { subject }.to change { ip_block.reload.comment }.from('Spam').to('Decreasing severity') + def change_comment_value + change { ip_block.reload.comment }.from('Spam').to('Decreasing severity') end context 'when ip block does not exist' do