Add role-specific user fabricators (#33437)
This commit is contained in:
parent
a8a16695f1
commit
7cbdcd7b3f
105 changed files with 125 additions and 113 deletions
|
@ -8,7 +8,7 @@ RSpec.describe Admin::AccountAction do
|
|||
describe '#save!' do
|
||||
subject { account_action.save! }
|
||||
|
||||
let(:account) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
|
||||
let(:account) { Fabricate(:admin_user).account }
|
||||
let(:target_account) { Fabricate(:account) }
|
||||
let(:type) { 'disable' }
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe Form::AccountBatch do
|
|||
describe '#save' do
|
||||
subject { account_batch.save }
|
||||
|
||||
let(:account) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
|
||||
let(:account) { Fabricate(:admin_user).account }
|
||||
let(:account_ids) { [] }
|
||||
let(:query) { Account.none }
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe Form::CustomEmojiBatch do
|
|||
subject { described_class.new({ current_account: account }.merge(options)) }
|
||||
|
||||
let(:options) { {} }
|
||||
let(:account) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
|
||||
let(:account) { Fabricate(:admin_user).account }
|
||||
|
||||
context 'with empty custom_emoji_ids' do
|
||||
let(:options) { { custom_emoji_ids: [] } }
|
||||
|
|
|
@ -601,7 +601,7 @@ RSpec.describe User do
|
|||
end
|
||||
|
||||
describe '.those_who_can' do
|
||||
before { Fabricate(:user, role: UserRole.find_by(name: 'Moderator')) }
|
||||
before { Fabricate(:moderator_user) }
|
||||
|
||||
context 'when there are not any user roles' do
|
||||
before { UserRole.destroy_all }
|
||||
|
@ -618,7 +618,7 @@ RSpec.describe User do
|
|||
end
|
||||
|
||||
context 'when there are users with roles' do
|
||||
let!(:admin_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
let!(:admin_user) { Fabricate(:admin_user) }
|
||||
|
||||
it 'returns the users with the role' do
|
||||
expect(described_class.those_who_can(:manage_blocks)).to eq([admin_user])
|
||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe Webhook do
|
|||
subject { Fabricate.build :webhook, current_account: account }
|
||||
|
||||
context 'with account that has permissions' do
|
||||
let(:account) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
|
||||
let(:account) { Fabricate(:admin_user).account }
|
||||
|
||||
it { is_expected.to allow_values(%w(account.created)).for(:events) }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue