1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Reduce .times usage in lib/mastodon/cli/accounts spec (#27944)

This commit is contained in:
Matt Jankowski 2023-11-20 04:04:46 -05:00 committed by GitHub
parent 12c22ee5e7
commit 1fabf20a88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -465,7 +465,7 @@ describe Mastodon::CLI::Accounts do
end end
describe '#approve' do describe '#approve' do
let(:total_users) { 10 } let(:total_users) { 4 }
before do before do
Form::AdminSettings.new(registrations_mode: 'approved').save Form::AdminSettings.new(registrations_mode: 'approved').save
@ -482,7 +482,7 @@ describe Mastodon::CLI::Accounts do
context 'with --number option' do context 'with --number option' do
context 'when the number is positive' do context 'when the number is positive' do
let(:options) { { number: 3 } } let(:options) { { number: 2 } }
it 'approves the earliest n pending registrations' do it 'approves the earliest n pending registrations' do
cli.invoke(:approve, nil, options) cli.invoke(:approve, nil, options)
@ -978,7 +978,7 @@ describe Mastodon::CLI::Accounts do
end end
context 'when --all option is provided' do context 'when --all option is provided' do
let(:accounts) { Fabricate.times(3, :account) } let(:accounts) { Fabricate.times(2, :account) }
let(:options) { { all: true } } let(:options) { { all: true } }
before do before do
@ -1269,7 +1269,7 @@ describe Mastodon::CLI::Accounts do
end end
context 'when the given username is found' do context 'when the given username is found' do
let(:total_relationships) { 10 } let(:total_relationships) { 3 }
let!(:accounts) { Fabricate.times(total_relationships, :account) } let!(:accounts) { Fabricate.times(total_relationships, :account) }
context 'with --follows option' do context 'with --follows option' do
@ -1324,8 +1324,8 @@ describe Mastodon::CLI::Accounts do
let(:options) { { followers: true, follows: true } } let(:options) { { followers: true, follows: true } }
before do before do
accounts.first(6).each { |account| account.follow!(target_account) } accounts.first(2).each { |account| account.follow!(target_account) }
accounts.last(4).each { |account| target_account.follow!(account) } accounts.last(1).each { |account| target_account.follow!(account) }
end end
it 'resets all "followers" relationships from the target account' do it 'resets all "followers" relationships from the target account' do
@ -1363,7 +1363,7 @@ describe Mastodon::CLI::Accounts do
let!(:group_account) { Fabricate(:account, actor_type: 'Group', domain: 'example.com') } let!(:group_account) { Fabricate(:account, actor_type: 'Group', domain: 'example.com') }
let!(:mentioned_account) { Fabricate(:account, domain: 'example.com') } let!(:mentioned_account) { Fabricate(:account, domain: 'example.com') }
let!(:prunable_accounts) do let!(:prunable_accounts) do
Fabricate.times(3, :account, domain: 'example.com', bot: false, suspended_at: nil, silenced_at: nil) Fabricate.times(2, :account, domain: 'example.com', bot: false, suspended_at: nil, silenced_at: nil)
end end
before do before do