From 0ba3ad4a354df6b7cdcc9fbad4dc50d86f429171 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 23 Sep 2024 04:45:05 -0400 Subject: [PATCH] Remove `body_json_ids` from api/v2/admin/accounts spec (#32003) --- spec/requests/api/v2/admin/accounts_spec.rb | 32 ++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/spec/requests/api/v2/admin/accounts_spec.rb b/spec/requests/api/v2/admin/accounts_spec.rb index bc3db4f886..1d1fda3e67 100644 --- a/spec/requests/api/v2/admin/accounts_spec.rb +++ b/spec/requests/api/v2/admin/accounts_spec.rb @@ -36,7 +36,10 @@ RSpec.describe 'API V2 Admin Accounts' do expect(response).to have_http_status(200) expect(response.content_type) .to start_with('application/json') - expect(body_json_ids).to eq([admin_account.id]) + expect(response.parsed_body) + .to contain_exactly( + hash_including(id: admin_account.id.to_s) + ) end end @@ -47,8 +50,11 @@ RSpec.describe 'API V2 Admin Accounts' do expect(response).to have_http_status(200) expect(response.content_type) .to start_with('application/json') - expect(body_json_ids).to include(remote_account.id) - expect(body_json_ids).to_not include(other_remote_account.id) + expect(response.parsed_body) + .to contain_exactly( + hash_including(id: remote_account.id.to_s) + ) + .and not_include(hash_including(id: other_remote_account.id.to_s)) end end @@ -59,7 +65,11 @@ RSpec.describe 'API V2 Admin Accounts' do expect(response).to have_http_status(200) expect(response.content_type) .to start_with('application/json') - expect(body_json_ids).to include(suspended_remote.id, suspended_account.id) + expect(response.parsed_body) + .to contain_exactly( + hash_including(id: suspended_remote.id.to_s), + hash_including(id: suspended_account.id.to_s) + ) end end @@ -70,7 +80,10 @@ RSpec.describe 'API V2 Admin Accounts' do expect(response).to have_http_status(200) expect(response.content_type) .to start_with('application/json') - expect(body_json_ids).to include(disabled_account.id) + expect(response.parsed_body) + .to contain_exactly( + hash_including(id: disabled_account.id.to_s) + ) end end @@ -81,14 +94,13 @@ RSpec.describe 'API V2 Admin Accounts' do expect(response).to have_http_status(200) expect(response.content_type) .to start_with('application/json') - expect(body_json_ids).to include(pending_account.id) + expect(response.parsed_body) + .to contain_exactly( + hash_including(id: pending_account.id.to_s) + ) end end - def body_json_ids - response.parsed_body.map { |a| a[:id].to_i } - end - context 'with limit param' do let(:params) { { limit: 1 } }