Audofix Rubocop Style/WordArray (#23739)

This commit is contained in:
Nick Schonning 2023-02-20 00:14:10 -05:00 committed by GitHub
parent 4552685f6b
commit bf785df9fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 27 additions and 50 deletions

View file

@ -37,13 +37,13 @@ RSpec.describe Api::V1::BlocksController, type: :controller do
it 'sets pagination header for next path' do
blocks = 2.times.map { Fabricate(:block, account: user.account) }
get :index, params: { limit: 1, since_id: blocks[0] }
expect(response.headers['Link'].find_link(['rel', 'next']).href).to eq api_v1_blocks_url(limit: 1, max_id: blocks[1])
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq api_v1_blocks_url(limit: 1, max_id: blocks[1])
end
it 'sets pagination header for previous path' do
block = Fabricate(:block, account: user.account)
get :index
expect(response.headers['Link'].find_link(['rel', 'prev']).href).to eq api_v1_blocks_url(since_id: block)
expect(response.headers['Link'].find_link(%w(rel prev)).href).to eq api_v1_blocks_url(since_id: block)
end
it 'returns http success' do

View file

@ -63,8 +63,8 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do
get :index, params: { limit: 1 }
expect(response.headers['Link'].find_link(['rel', 'next']).href).to eq "http://test.host/api/v1/bookmarks?limit=1&max_id=#{bookmark.id}"
expect(response.headers['Link'].find_link(['rel', 'prev']).href).to eq "http://test.host/api/v1/bookmarks?limit=1&min_id=#{bookmark.id}"
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq "http://test.host/api/v1/bookmarks?limit=1&max_id=#{bookmark.id}"
expect(response.headers['Link'].find_link(%w(rel prev)).href).to eq "http://test.host/api/v1/bookmarks?limit=1&min_id=#{bookmark.id}"
end
it 'does not add pagination headers if not necessary' do

View file

@ -63,8 +63,8 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
get :index, params: { limit: 1 }
expect(response.headers['Link'].find_link(['rel', 'next']).href).to eq "http://test.host/api/v1/favourites?limit=1&max_id=#{favourite.id}"
expect(response.headers['Link'].find_link(['rel', 'prev']).href).to eq "http://test.host/api/v1/favourites?limit=1&min_id=#{favourite.id}"
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq "http://test.host/api/v1/favourites?limit=1&max_id=#{favourite.id}"
expect(response.headers['Link'].find_link(%w(rel prev)).href).to eq "http://test.host/api/v1/favourites?limit=1&min_id=#{favourite.id}"
end
it 'does not add pagination headers if not necessary' do

View file

@ -37,13 +37,13 @@ RSpec.describe Api::V1::MutesController, type: :controller do
it 'sets pagination header for next path' do
mutes = 2.times.map { Fabricate(:mute, account: user.account) }
get :index, params: { limit: 1, since_id: mutes[0] }
expect(response.headers['Link'].find_link(['rel', 'next']).href).to eq api_v1_mutes_url(limit: 1, max_id: mutes[1])
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq api_v1_mutes_url(limit: 1, max_id: mutes[1])
end
it 'sets pagination header for previous path' do
mute = Fabricate(:mute, account: user.account)
get :index
expect(response.headers['Link'].find_link(['rel', 'prev']).href).to eq api_v1_mutes_url(since_id: mute)
expect(response.headers['Link'].find_link(%w(rel prev)).href).to eq api_v1_mutes_url(since_id: mute)
end
it 'returns http success' do

View file

@ -73,7 +73,7 @@ describe Settings::ApplicationsController do
name: 'My New App',
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
website: 'http://google.com',
scopes: ['read', 'write', 'follow'],
scopes: %w(read write follow),
},
}
response

View file

@ -23,7 +23,7 @@ describe Settings::Preferences::OtherController do
expect(response).to redirect_to(settings_preferences_other_path)
user.reload
expect(user.locale).to eq 'en'
expect(user.chosen_languages).to eq ['es', 'fr']
expect(user.chosen_languages).to eq %w(es fr)
end
it 'updates user settings' do

View file

@ -895,7 +895,7 @@ RSpec.describe Account, type: :model do
describe 'partitioned' do
it 'returns a relation of accounts partitioned by domain' do
matches = ['a', 'b', 'a', 'b']
matches = %w(a b a b)
matches.size.times.to_a.shuffle.each do |index|
matches[index] = Fabricate(:account, domain: matches[index])
end

View file

@ -262,7 +262,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
let!(:direct_message) { Fabricate(:status, created_at: 1.year.ago, account: account, visibility: :direct) }
let!(:self_faved) { Fabricate(:status, created_at: 1.year.ago, account: account) }
let!(:self_bookmarked) { Fabricate(:status, created_at: 1.year.ago, account: account) }
let!(:status_with_poll) { Fabricate(:status, created_at: 1.year.ago, account: account, poll_attributes: { account: account, voters_count: 0, options: ['a', 'b'], expires_in: 2.days }) }
let!(:status_with_poll) { Fabricate(:status, created_at: 1.year.ago, account: account, poll_attributes: { account: account, voters_count: 0, options: %w(a b), expires_in: 2.days }) }
let!(:status_with_media) { Fabricate(:status, created_at: 1.year.ago, account: account) }
let!(:faved4) { Fabricate(:status, created_at: 1.year.ago, account: account) }
let!(:faved5) { Fabricate(:status, created_at: 1.year.ago, account: account) }

View file

@ -29,7 +29,7 @@ RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service d
end
it 'sets expected tags as pinned tags' do
expect(actor.featured_tags.map(&:display_name)).to match_array ['Foo', 'bar', 'baZ']
expect(actor.featured_tags.map(&:display_name)).to match_array %w(Foo bar baZ)
end
end

View file

@ -12,7 +12,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
attachment: [
{ type: 'PropertyValue', name: 'Pronouns', value: 'They/them' },
{ type: 'PropertyValue', name: 'Occupation', value: 'Unit test' },
{ type: 'PropertyValue', name: 'non-string', value: ['foo', 'bar'] },
{ type: 'PropertyValue', name: 'non-string', value: %w(foo bar) },
],
}.with_indifferent_access
end

View file

@ -50,9 +50,9 @@ RSpec.describe DeleteAccountService, type: :service do
it 'deletes associated target notifications' do
expect { subject }.to change {
[
'poll', 'favourite', 'status', 'mention', 'follow'
].map { |type| Notification.where(type: type).count }
%w(
poll favourite status mention follow
).map { |type| Notification.where(type: type).count }
}.from([1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0])
end
end

View file

@ -19,7 +19,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
[
{
'concurrency' => 2,
'queues' => ['push', 'default'],
'queues' => %w(push default),
},
]
end
@ -82,7 +82,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
describe '#get_budget' do
context 'on a single thread' do
let(:process_set_stub) { [{ 'concurrency' => 1, 'queues' => ['push', 'default'] }] }
let(:process_set_stub) { [{ 'concurrency' => 1, 'queues' => %w(push default) }] }
it 'returns a low value' do
expect(subject.compute_budget).to be < 10
@ -92,7 +92,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
context 'on a lot of threads' do
let(:process_set_stub) do
[
{ 'concurrency' => 2, 'queues' => ['push', 'default'] },
{ 'concurrency' => 2, 'queues' => %w(push default) },
{ 'concurrency' => 2, 'queues' => ['push'] },
{ 'concurrency' => 2, 'queues' => ['push'] },
{ 'concurrency' => 2, 'queues' => ['push'] },