Autofix Rubocop RSpec/MatchArray (#24050)
This commit is contained in:
parent
91a8cd21d8
commit
a3393d0d07
20 changed files with 53 additions and 76 deletions
|
@ -26,22 +26,22 @@ describe AccountFilter do
|
|||
|
||||
it 'works with domain first and origin remote' do
|
||||
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
|
||||
|
||||
it 'works with domain last and origin remote' do
|
||||
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
|
||||
|
||||
it 'works with domain first and origin local' do
|
||||
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
|
||||
|
||||
it 'works with domain last and origin local' do
|
||||
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
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ RSpec.describe Account, type: :model do
|
|||
it 'returns the domains blocked by the account' do
|
||||
account = Fabricate(:account)
|
||||
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
|
||||
|
||||
|
@ -877,7 +877,7 @@ RSpec.describe Account, type: :model do
|
|||
it 'returns an array of accounts who have a domain' do
|
||||
account_1 = Fabricate(:account, domain: nil)
|
||||
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
|
||||
|
||||
|
@ -885,7 +885,7 @@ RSpec.describe Account, type: :model do
|
|||
it 'returns an array of accounts who do not have a domain' do
|
||||
account_1 = Fabricate(:account, domain: nil)
|
||||
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
|
||||
|
||||
|
@ -911,7 +911,7 @@ RSpec.describe Account, type: :model do
|
|||
it 'returns an array of accounts who are silenced' do
|
||||
account_1 = Fabricate(:account, silenced: true)
|
||||
account_2 = Fabricate(:account, silenced: false)
|
||||
expect(Account.silenced).to match_array([account_1])
|
||||
expect(Account.silenced).to contain_exactly(account_1)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -919,7 +919,7 @@ RSpec.describe Account, type: :model do
|
|||
it 'returns an array of accounts who are suspended' do
|
||||
account_1 = Fabricate(:account, suspended: true)
|
||||
account_2 = Fabricate(:account, suspended: false)
|
||||
expect(Account.suspended).to match_array([account_1])
|
||||
expect(Account.suspended).to contain_exactly(account_1)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -941,11 +941,11 @@ RSpec.describe Account, type: :model do
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
|
|
@ -496,7 +496,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ RSpec.describe CustomEmojiFilter do
|
|||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
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
|
||||
|
||||
|
@ -25,7 +25,7 @@ RSpec.describe CustomEmojiFilter do
|
|||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
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
|
||||
|
||||
|
@ -34,7 +34,7 @@ RSpec.describe CustomEmojiFilter do
|
|||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
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
|
||||
|
||||
|
@ -43,7 +43,7 @@ RSpec.describe CustomEmojiFilter do
|
|||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
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
|
||||
|
||||
|
@ -63,7 +63,7 @@ RSpec.describe CustomEmojiFilter do
|
|||
|
||||
it 'returns ActiveRecord::Relation' do
|
||||
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
|
||||
|
|
|
@ -265,17 +265,17 @@ RSpec.describe Status, type: :model do
|
|||
|
||||
context 'when given one tag' 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([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([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([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 contain_exactly(status2.id, status5.id)
|
||||
expect(Status.tagged_with([tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status3.id, status5.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when given multiple tags' 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, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([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([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 contain_exactly(status1.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
|
||||
|
@ -292,15 +292,15 @@ RSpec.describe Status, type: :model do
|
|||
|
||||
context 'when given one tag' 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([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([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([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 contain_exactly(status2.id, status5.id)
|
||||
expect(Status.tagged_with_all([tag3.id]).reorder(:id).pluck(:id).uniq).to contain_exactly(status3.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when given multiple tags' 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([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq []
|
||||
end
|
||||
|
@ -319,17 +319,17 @@ RSpec.describe Status, type: :model do
|
|||
|
||||
context 'when given one tag' 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([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([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([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 contain_exactly(status1.id, status3.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
|
||||
|
||||
context 'when given multiple tags' 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, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([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([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 contain_exactly(status2.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
|
||||
|
|
|
@ -65,7 +65,7 @@ RSpec.describe User, type: :model do
|
|||
it 'returns an array of users who are confirmed' do
|
||||
user_1 = Fabricate(:user, confirmed_at: nil)
|
||||
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
|
||||
|
||||
|
@ -74,7 +74,7 @@ RSpec.describe User, type: :model do
|
|||
specified = Fabricate(:user, current_sign_in_at: 15.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
|
||||
|
||||
|
@ -83,7 +83,7 @@ RSpec.describe User, type: :model do
|
|||
specified = Fabricate(:user, email: 'specified@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
|
||||
|
||||
|
@ -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::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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue