diff --git a/spec/controllers/activitypub/outboxes_controller_spec.rb b/spec/controllers/activitypub/outboxes_controller_spec.rb index 7ae28e8e09..ca986dcabb 100644 --- a/spec/controllers/activitypub/outboxes_controller_spec.rb +++ b/spec/controllers/activitypub/outboxes_controller_spec.rb @@ -69,9 +69,10 @@ RSpec.describe ActivityPub::OutboxesController do expect(response.parsed_body) .to include( - orderedItems: be_an(Array).and(have_attributes(size: 2)) + orderedItems: be_an(Array) + .and(have_attributes(size: 2)) + .and(all(satisfy { |item| targets_public_collection?(item) })) ) - expect(response.parsed_body[:orderedItems].all? { |item| targets_public_collection?(item) }).to be true end context 'when account is permanently suspended' do @@ -113,9 +114,10 @@ RSpec.describe ActivityPub::OutboxesController do expect(response.parsed_body) .to include( - orderedItems: be_an(Array).and(have_attributes(size: 2)) + orderedItems: be_an(Array) + .and(have_attributes(size: 2)) + .and(all(satisfy { |item| targets_public_collection?(item) })) ) - expect(response.parsed_body[:orderedItems].all? { |item| targets_public_collection?(item) }).to be true end end @@ -132,9 +134,10 @@ RSpec.describe ActivityPub::OutboxesController do expect(response.parsed_body) .to include( - orderedItems: be_an(Array).and(have_attributes(size: 3)) + orderedItems: be_an(Array) + .and(have_attributes(size: 3)) + .and(all(satisfy { |item| targets_public_collection?(item) || targets_followers_collection?(item, account) })) ) - expect(response.parsed_body[:orderedItems].all? { |item| targets_public_collection?(item) || targets_followers_collection?(item, account) }).to be true end end diff --git a/spec/requests/api/v1/admin/tags_spec.rb b/spec/requests/api/v1/admin/tags_spec.rb index 3623c09ac7..696a11da67 100644 --- a/spec/requests/api/v1/admin/tags_spec.rb +++ b/spec/requests/api/v1/admin/tags_spec.rb @@ -82,8 +82,11 @@ RSpec.describe 'Tags' do expect(response.content_type) .to start_with('application/json') - expect(response.parsed_body[:id].to_i).to eq(tag.id) - expect(response.parsed_body[:name]).to eq(tag.name) + expect(response.parsed_body) + .to include( + id: tag.id.to_s, + name: tag.name + ) end context 'when the requested tag does not exist' do @@ -116,8 +119,11 @@ RSpec.describe 'Tags' do expect(response.content_type) .to start_with('application/json') - expect(response.parsed_body[:id].to_i).to eq(tag.id) - expect(response.parsed_body[:name]).to eq(tag.name.upcase) + expect(response.parsed_body) + .to include( + id: tag.id.to_s, + name: tag.name.upcase + ) end context 'when the updated display name is invalid' do diff --git a/spec/requests/api/v1/apps/credentials_spec.rb b/spec/requests/api/v1/apps/credentials_spec.rb index 30200ed60c..8e5fa14b7e 100644 --- a/spec/requests/api/v1/apps/credentials_spec.rb +++ b/spec/requests/api/v1/apps/credentials_spec.rb @@ -41,8 +41,9 @@ RSpec.describe 'Credentials' do expect(response.content_type) .to start_with('application/json') - expect(response.parsed_body[:client_id]).to_not be_present - expect(response.parsed_body[:client_secret]).to_not be_present + expect(response.parsed_body) + .to not_include(client_id: be_present) + .and not_include(client_secret: be_present) end end