1
0
Fork 0
forked from fedi/mastodon

Autofix Rubocop RSpec/MatchArray (#24050)

This commit is contained in:
Nick Schonning 2023-04-26 14:21:54 -04:00 committed by GitHub
parent 91a8cd21d8
commit a3393d0d07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 53 additions and 76 deletions

View file

@ -779,29 +779,6 @@ RSpec/LetSetup:
- 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb'
- 'spec/workers/scheduler/user_cleanup_scheduler_spec.rb' - 'spec/workers/scheduler/user_cleanup_scheduler_spec.rb'
# This cop supports safe autocorrection (--autocorrect).
RSpec/MatchArray:
Exclude:
- 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb'
- 'spec/controllers/admin/export_domain_blocks_controller_spec.rb'
- 'spec/controllers/api/v1/accounts/follower_accounts_controller_spec.rb'
- 'spec/controllers/api/v1/accounts/following_accounts_controller_spec.rb'
- 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb'
- 'spec/controllers/api/v1/bookmarks_controller_spec.rb'
- 'spec/controllers/api/v1/favourites_controller_spec.rb'
- 'spec/controllers/api/v1/reports_controller_spec.rb'
- 'spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb'
- 'spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb'
- 'spec/models/account_filter_spec.rb'
- 'spec/models/account_spec.rb'
- 'spec/models/account_statuses_cleanup_policy_spec.rb'
- 'spec/models/custom_emoji_filter_spec.rb'
- 'spec/models/status_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/presenters/familiar_followers_presenter_spec.rb'
- 'spec/services/activitypub/fetch_featured_collection_service_spec.rb'
- 'spec/services/update_status_service_spec.rb'
RSpec/MessageChain: RSpec/MessageChain:
Exclude: Exclude:
- 'spec/controllers/api/v1/media_controller_spec.rb' - 'spec/controllers/api/v1/media_controller_spec.rb'

View file

@ -50,7 +50,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll
it 'returns orderedItems with followers from example.com' do it 'returns orderedItems with followers from example.com' do
expect(body[:orderedItems]).to be_an Array expect(body[:orderedItems]).to be_an Array
expect(body[:orderedItems]).to match_array([follower_4.uri, follower_1.uri, follower_2.uri]) expect(body[:orderedItems]).to contain_exactly(follower_4.uri, follower_1.uri, follower_2.uri)
end end
it 'returns private Cache-Control header' do it 'returns private Cache-Control header' do

View file

@ -29,7 +29,7 @@ RSpec.describe Admin::ExportDomainBlocksController, type: :controller do
end end
it 'renders page with expected domain blocks' do it 'renders page with expected domain blocks' do
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to match_array [['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop]] expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop])
end end
it 'returns http success' do it 'returns http success' do
@ -43,7 +43,7 @@ RSpec.describe Admin::ExportDomainBlocksController, type: :controller do
end end
it 'renders page with expected domain blocks' do it 'renders page with expected domain blocks' do
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to match_array [['bad.domain', :suspend], ['worse.domain', :suspend], ['reject.media', :suspend]] expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :suspend], ['worse.domain', :suspend], ['reject.media', :suspend])
end end
it 'returns http success' do it 'returns http success' do

View file

@ -28,7 +28,7 @@ describe Api::V1::Accounts::FollowerAccountsController do
get :index, params: { account_id: account.id, limit: 2 } get :index, params: { account_id: account.id, limit: 2 }
expect(body_as_json.size).to eq 2 expect(body_as_json.size).to eq 2
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s]) expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
end end
it 'does not return blocked users' do it 'does not return blocked users' do
@ -58,7 +58,7 @@ describe Api::V1::Accounts::FollowerAccountsController do
get :index, params: { account_id: account.id, limit: 2 } get :index, params: { account_id: account.id, limit: 2 }
expect(body_as_json.size).to eq 2 expect(body_as_json.size).to eq 2
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s]) expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
end end
end end
end end

View file

@ -28,7 +28,7 @@ describe Api::V1::Accounts::FollowingAccountsController do
get :index, params: { account_id: account.id, limit: 2 } get :index, params: { account_id: account.id, limit: 2 }
expect(body_as_json.size).to eq 2 expect(body_as_json.size).to eq 2
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s]) expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
end end
it 'does not return blocked users' do it 'does not return blocked users' do
@ -58,7 +58,7 @@ describe Api::V1::Accounts::FollowingAccountsController do
get :index, params: { account_id: account.id, limit: 2 } get :index, params: { account_id: account.id, limit: 2 }
expect(body_as_json.size).to eq 2 expect(body_as_json.size).to eq 2
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s]) expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
end end
end end
end end

View file

@ -99,7 +99,7 @@ describe Api::V1::Accounts::StatusesController do
it 'lists both the public and the private statuses' do it 'lists both the public and the private statuses' do
get :index, params: { account_id: account.id, pinned: true } get :index, params: { account_id: account.id, pinned: true }
json = body_as_json json = body_as_json
expect(json.map { |item| item[:id].to_i }).to match_array([status.id, private_status.id]) expect(json.map { |item| item[:id].to_i }).to contain_exactly(status.id, private_status.id)
end end
end end
end end

View file

@ -57,7 +57,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do
get :index get :index
expect(assigns(:statuses)).to match_array [bookmarked_by_user.status] expect(assigns(:statuses)).to contain_exactly(bookmarked_by_user.status)
end end
it 'adds pagination headers if necessary' do it 'adds pagination headers if necessary' do

View file

@ -57,7 +57,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
get :index get :index
expect(assigns(:statuses)).to match_array [favourite_by_user.status] expect(assigns(:statuses)).to contain_exactly(favourite_by_user.status)
end end
it 'adds pagination headers if necessary' do it 'adds pagination headers if necessary' do

View file

@ -69,7 +69,7 @@ RSpec.describe Api::V1::ReportsController, type: :controller do
end end
it 'saves rule_ids' do it 'saves rule_ids' do
expect(target_account.targeted_reports.first.rule_ids).to match_array([rule.id]) expect(target_account.targeted_reports.first.rule_ids).to contain_exactly(rule.id)
end end
end end
end end

View file

@ -33,7 +33,7 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
it 'returns accounts who favorited the status' do it 'returns accounts who favorited the status' do
get :index, params: { status_id: status.id, limit: 2 } get :index, params: { status_id: status.id, limit: 2 }
expect(body_as_json.size).to eq 2 expect(body_as_json.size).to eq 2
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s]) expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
end end
it 'does not return blocked users' do it 'does not return blocked users' do

View file

@ -33,7 +33,7 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controll
it 'returns accounts who reblogged the status' do it 'returns accounts who reblogged the status' do
get :index, params: { status_id: status.id, limit: 2 } get :index, params: { status_id: status.id, limit: 2 }
expect(body_as_json.size).to eq 2 expect(body_as_json.size).to eq 2
expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s]) expect([body_as_json[0][:id], body_as_json[1][:id]]).to contain_exactly(alice.id.to_s, bob.id.to_s)
end end
it 'does not return blocked users' do it 'does not return blocked users' do

View file

@ -26,22 +26,22 @@ describe AccountFilter do
it 'works with domain first and origin remote' do it 'works with domain first and origin remote' do
filter = described_class.new(by_domain: 'example.org', origin: 'remote') filter = described_class.new(by_domain: 'example.org', origin: 'remote')
expect(filter.results).to match_array [remote_account_one] expect(filter.results).to contain_exactly(remote_account_one)
end end
it 'works with domain last and origin remote' do it 'works with domain last and origin remote' do
filter = described_class.new(origin: 'remote', by_domain: 'example.org') filter = described_class.new(origin: 'remote', by_domain: 'example.org')
expect(filter.results).to match_array [remote_account_one] expect(filter.results).to contain_exactly(remote_account_one)
end end
it 'works with domain first and origin local' do it 'works with domain first and origin local' do
filter = described_class.new(by_domain: 'example.org', origin: 'local') filter = described_class.new(by_domain: 'example.org', origin: 'local')
expect(filter.results).to match_array [local_account] expect(filter.results).to contain_exactly(local_account)
end end
it 'works with domain last and origin local' do it 'works with domain last and origin local' do
filter = described_class.new(origin: 'local', by_domain: 'example.org') filter = described_class.new(origin: 'local', by_domain: 'example.org')
expect(filter.results).to match_array [remote_account_one] expect(filter.results).to contain_exactly(remote_account_one)
end end
end end

View file

@ -339,7 +339,7 @@ RSpec.describe Account, type: :model do
it 'returns the domains blocked by the account' do it 'returns the domains blocked by the account' do
account = Fabricate(:account) account = Fabricate(:account)
account.block_domain!('domain') account.block_domain!('domain')
expect(account.excluded_from_timeline_domains).to match_array ['domain'] expect(account.excluded_from_timeline_domains).to contain_exactly('domain')
end end
end end
@ -877,7 +877,7 @@ RSpec.describe Account, type: :model do
it 'returns an array of accounts who have a domain' do it 'returns an array of accounts who have a domain' do
account_1 = Fabricate(:account, domain: nil) account_1 = Fabricate(:account, domain: nil)
account_2 = Fabricate(:account, domain: 'example.com') account_2 = Fabricate(:account, domain: 'example.com')
expect(Account.remote).to match_array([account_2]) expect(Account.remote).to contain_exactly(account_2)
end end
end end
@ -885,7 +885,7 @@ RSpec.describe Account, type: :model do
it 'returns an array of accounts who do not have a domain' do it 'returns an array of accounts who do not have a domain' do
account_1 = Fabricate(:account, domain: nil) account_1 = Fabricate(:account, domain: nil)
account_2 = Fabricate(:account, domain: 'example.com') account_2 = Fabricate(:account, domain: 'example.com')
expect(Account.where('id > 0').local).to match_array([account_1]) expect(Account.where('id > 0').local).to contain_exactly(account_1)
end end
end end
@ -911,7 +911,7 @@ RSpec.describe Account, type: :model do
it 'returns an array of accounts who are silenced' do it 'returns an array of accounts who are silenced' do
account_1 = Fabricate(:account, silenced: true) account_1 = Fabricate(:account, silenced: true)
account_2 = Fabricate(:account, silenced: false) account_2 = Fabricate(:account, silenced: false)
expect(Account.silenced).to match_array([account_1]) expect(Account.silenced).to contain_exactly(account_1)
end end
end end
@ -919,7 +919,7 @@ RSpec.describe Account, type: :model do
it 'returns an array of accounts who are suspended' do it 'returns an array of accounts who are suspended' do
account_1 = Fabricate(:account, suspended: true) account_1 = Fabricate(:account, suspended: true)
account_2 = Fabricate(:account, suspended: false) account_2 = Fabricate(:account, suspended: false)
expect(Account.suspended).to match_array([account_1]) expect(Account.suspended).to contain_exactly(account_1)
end end
end end
@ -941,11 +941,11 @@ RSpec.describe Account, type: :model do
end end
it 'returns every usable non-suspended account' do it 'returns every usable non-suspended account' do
expect(Account.searchable).to match_array([silenced_local, silenced_remote, local_account, remote_account]) expect(Account.searchable).to contain_exactly(silenced_local, silenced_remote, local_account, remote_account)
end end
it 'does not mess with previously-applied scopes' do it 'does not mess with previously-applied scopes' do
expect(Account.where.not(id: remote_account.id).searchable).to match_array([silenced_local, silenced_remote, local_account]) expect(Account.where.not(id: remote_account.id).searchable).to contain_exactly(silenced_local, silenced_remote, local_account)
end end
end end
end end

View file

@ -496,7 +496,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
end end
it 'returns only normal statuses for deletion' do it 'returns only normal statuses for deletion' do
expect(subject.pluck(:id)).to match_array([very_old_status.id, faved4.id, faved5.id, reblogged4.id, reblogged5.id]) expect(subject.pluck(:id)).to contain_exactly(very_old_status.id, faved4.id, faved5.id, reblogged4.id, reblogged5.id)
end end
end end

View file

@ -16,7 +16,7 @@ RSpec.describe CustomEmojiFilter do
it 'returns ActiveRecord::Relation' do it 'returns ActiveRecord::Relation' do
expect(subject).to be_a(ActiveRecord::Relation) expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_2]) expect(subject).to contain_exactly(custom_emoji_2)
end end
end end
@ -25,7 +25,7 @@ RSpec.describe CustomEmojiFilter do
it 'returns ActiveRecord::Relation' do it 'returns ActiveRecord::Relation' do
expect(subject).to be_a(ActiveRecord::Relation) expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0, custom_emoji_1]) expect(subject).to contain_exactly(custom_emoji_0, custom_emoji_1)
end end
end end
@ -34,7 +34,7 @@ RSpec.describe CustomEmojiFilter do
it 'returns ActiveRecord::Relation' do it 'returns ActiveRecord::Relation' do
expect(subject).to be_a(ActiveRecord::Relation) expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0]) expect(subject).to contain_exactly(custom_emoji_0)
end end
end end
@ -43,7 +43,7 @@ RSpec.describe CustomEmojiFilter do
it 'returns ActiveRecord::Relation' do it 'returns ActiveRecord::Relation' do
expect(subject).to be_a(ActiveRecord::Relation) expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_2]) expect(subject).to contain_exactly(custom_emoji_2)
end end
end end
@ -63,7 +63,7 @@ RSpec.describe CustomEmojiFilter do
it 'returns ActiveRecord::Relation' do it 'returns ActiveRecord::Relation' do
expect(subject).to be_a(ActiveRecord::Relation) expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0, custom_emoji_1, custom_emoji_2]) expect(subject).to contain_exactly(custom_emoji_0, custom_emoji_1, custom_emoji_2)
end end
end end
end end

View file

@ -265,17 +265,17 @@ RSpec.describe Status, type: :model do
context 'when given one tag' do context 'when given one tag' do
it 'returns the expected statuses' do it 'returns the expected statuses' do
expect(Status.tagged_with([tag1.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status5.id]) expect(Status.tagged_with([tag1.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status1.id, status5.id)
expect(Status.tagged_with([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status5.id]) expect(Status.tagged_with([tag2.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status2.id, status5.id)
expect(Status.tagged_with([tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status3.id, status5.id]) expect(Status.tagged_with([tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status3.id, status5.id)
end end
end end
context 'when given multiple tags' do context 'when given multiple tags' do
it 'returns the expected statuses' do it 'returns the expected statuses' do
expect(Status.tagged_with([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status2.id, status5.id]) expect(Status.tagged_with([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status1.id, status2.id, status5.id)
expect(Status.tagged_with([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status3.id, status5.id]) expect(Status.tagged_with([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status1.id, status3.id, status5.id)
expect(Status.tagged_with([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status3.id, status5.id]) expect(Status.tagged_with([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status2.id, status3.id, status5.id)
end end
end end
end end
@ -292,15 +292,15 @@ RSpec.describe Status, type: :model do
context 'when given one tag' do context 'when given one tag' do
it 'returns the expected statuses' do it 'returns the expected statuses' do
expect(Status.tagged_with_all([tag1.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status5.id]) expect(Status.tagged_with_all([tag1.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status1.id, status5.id)
expect(Status.tagged_with_all([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status5.id]) expect(Status.tagged_with_all([tag2.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status2.id, status5.id)
expect(Status.tagged_with_all([tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status3.id]) expect(Status.tagged_with_all([tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status3.id)
end end
end end
context 'when given multiple tags' do context 'when given multiple tags' do
it 'returns the expected statuses' do it 'returns the expected statuses' do
expect(Status.tagged_with_all([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status5.id]) expect(Status.tagged_with_all([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status5.id)
expect(Status.tagged_with_all([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq [] expect(Status.tagged_with_all([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq []
expect(Status.tagged_with_all([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq [] expect(Status.tagged_with_all([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq []
end end
@ -319,17 +319,17 @@ RSpec.describe Status, type: :model do
context 'when given one tag' do context 'when given one tag' do
it 'returns the expected statuses' do it 'returns the expected statuses' do
expect(Status.tagged_with_none([tag1.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status3.id, status4.id]) expect(Status.tagged_with_none([tag1.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status2.id, status3.id, status4.id)
expect(Status.tagged_with_none([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status3.id, status4.id]) expect(Status.tagged_with_none([tag2.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status1.id, status3.id, status4.id)
expect(Status.tagged_with_none([tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status2.id, status4.id]) expect(Status.tagged_with_none([tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status1.id, status2.id, status4.id)
end end
end end
context 'when given multiple tags' do context 'when given multiple tags' do
it 'returns the expected statuses' do it 'returns the expected statuses' do
expect(Status.tagged_with_none([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status3.id, status4.id]) expect(Status.tagged_with_none([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status3.id, status4.id)
expect(Status.tagged_with_none([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status4.id]) expect(Status.tagged_with_none([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status2.id, status4.id)
expect(Status.tagged_with_none([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status4.id]) expect(Status.tagged_with_none([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status1.id, status4.id)
end end
end end
end end

View file

@ -65,7 +65,7 @@ RSpec.describe User, type: :model do
it 'returns an array of users who are confirmed' do it 'returns an array of users who are confirmed' do
user_1 = Fabricate(:user, confirmed_at: nil) user_1 = Fabricate(:user, confirmed_at: nil)
user_2 = Fabricate(:user, confirmed_at: Time.zone.now) user_2 = Fabricate(:user, confirmed_at: Time.zone.now)
expect(User.confirmed).to match_array([user_2]) expect(User.confirmed).to contain_exactly(user_2)
end end
end end
@ -74,7 +74,7 @@ RSpec.describe User, type: :model do
specified = Fabricate(:user, current_sign_in_at: 15.days.ago) specified = Fabricate(:user, current_sign_in_at: 15.days.ago)
Fabricate(:user, current_sign_in_at: 6.days.ago) Fabricate(:user, current_sign_in_at: 6.days.ago)
expect(User.inactive).to match_array([specified]) expect(User.inactive).to contain_exactly(specified)
end end
end end
@ -83,7 +83,7 @@ RSpec.describe User, type: :model do
specified = Fabricate(:user, email: 'specified@spec') specified = Fabricate(:user, email: 'specified@spec')
Fabricate(:user, email: 'unspecified@spec') Fabricate(:user, email: 'unspecified@spec')
expect(User.matches_email('specified')).to match_array([specified]) expect(User.matches_email('specified')).to contain_exactly(specified)
end end
end end
@ -96,7 +96,7 @@ RSpec.describe User, type: :model do
Fabricate(:session_activation, user: user2, ip: '2160:8888::24', session_id: '3') Fabricate(:session_activation, user: user2, ip: '2160:8888::24', session_id: '3')
Fabricate(:session_activation, user: user2, ip: '2160:8888::25', session_id: '4') Fabricate(:session_activation, user: user2, ip: '2160:8888::25', session_id: '4')
expect(User.matches_ip('2160:2160::/32')).to match_array([user1]) expect(User.matches_ip('2160:2160::/32')).to contain_exactly(user1)
end end
end end
end end

View file

@ -24,7 +24,7 @@ RSpec.describe FamiliarFollowersPresenter do
expect(result).to_not be_nil expect(result).to_not be_nil
expect(result.id).to eq requested_accounts.first.id expect(result.id).to eq requested_accounts.first.id
expect(result.accounts).to match_array([familiar_follower]) expect(result.accounts).to contain_exactly(familiar_follower)
end end
context 'when requested account hides followers' do context 'when requested account hides followers' do

View file

@ -71,7 +71,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
end end
it 'sets expected posts as pinned posts' do it 'sets expected posts as pinned posts' do
expect(actor.pinned_statuses.pluck(:uri)).to match_array ['https://example.com/account/pinned/1', 'https://example.com/account/pinned/2', 'https://example.com/account/pinned/4'] expect(actor.pinned_statuses.pluck(:uri)).to contain_exactly('https://example.com/account/pinned/1', 'https://example.com/account/pinned/2', 'https://example.com/account/pinned/4')
end end
end end

View file

@ -162,7 +162,7 @@ RSpec.describe UpdateStatusService, type: :service do
end end
it 'keeps old mentions as silent mentions' do it 'keeps old mentions as silent mentions' do
expect(status.mentions.pluck(:account_id)).to match_array([alice.id, bob.id]) expect(status.mentions.pluck(:account_id)).to contain_exactly(alice.id, bob.id)
end end
end end