Add role-specific user fabricators (#33437)

This commit is contained in:
Matt Jankowski 2025-01-03 03:28:14 -05:00 committed by GitHub
parent a8a16695f1
commit 7cbdcd7b3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
105 changed files with 125 additions and 113 deletions

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::AccountActionsController do RSpec.describe Admin::AccountActionsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -8,7 +8,7 @@ RSpec.describe Admin::AccountsController do
before { sign_in current_user, scope: :user } before { sign_in current_user, scope: :user }
describe 'GET #index' do describe 'GET #index' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
let(:params) do let(:params) do
{ {
origin: 'local', origin: 'local',
@ -53,7 +53,7 @@ RSpec.describe Admin::AccountsController do
end end
describe 'GET #show' do describe 'GET #show' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
describe 'account moderation notes' do describe 'account moderation notes' do
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }

View File

@ -16,7 +16,7 @@ RSpec.describe Admin::ActionLogsController do
describe 'GET #index' do describe 'GET #index' do
it 'returns 200' do it 'returns 200' do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')) sign_in Fabricate(:admin_user)
get :index, params: { page: 1 } get :index, params: { page: 1 }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)

View File

@ -20,7 +20,7 @@ RSpec.describe Admin::BaseController do
it 'returns private cache control headers' do it 'returns private cache control headers' do
routes.draw { get 'success' => 'admin/base#success' } routes.draw { get 'success' => 'admin/base#success' }
sign_in(Fabricate(:user, role: UserRole.find_by(name: 'Moderator'))) sign_in(Fabricate(:moderator_user))
get :success get :success
expect(response.headers['Cache-Control']).to include('private, no-store') expect(response.headers['Cache-Control']).to include('private, no-store')
@ -28,14 +28,14 @@ RSpec.describe Admin::BaseController do
it 'renders admin layout as a moderator' do it 'renders admin layout as a moderator' do
routes.draw { get 'success' => 'admin/base#success' } routes.draw { get 'success' => 'admin/base#success' }
sign_in(Fabricate(:user, role: UserRole.find_by(name: 'Moderator'))) sign_in(Fabricate(:moderator_user))
get :success get :success
expect(response).to render_template layout: 'admin' expect(response).to render_template layout: 'admin'
end end
it 'renders admin layout as an admin' do it 'renders admin layout as an admin' do
routes.draw { get 'success' => 'admin/base#success' } routes.draw { get 'success' => 'admin/base#success' }
sign_in(Fabricate(:user, role: UserRole.find_by(name: 'Admin'))) sign_in(Fabricate(:admin_user))
get :success get :success
expect(response).to render_template layout: 'admin' expect(response).to render_template layout: 'admin'
end end

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::ChangeEmailsController do RSpec.describe Admin::ChangeEmailsController do
render_views render_views
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:admin) { Fabricate(:admin_user) }
before do before do
sign_in admin sign_in admin

View File

@ -6,7 +6,7 @@ RSpec.describe Admin::ConfirmationsController do
render_views render_views
before do before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
describe 'POST #create' do describe 'POST #create' do

View File

@ -6,7 +6,7 @@ RSpec.describe Admin::DashboardController do
render_views render_views
describe 'GET #index' do describe 'GET #index' do
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')) } let(:user) { Fabricate(:owner_user) }
before do before do
stub_system_checks stub_system_checks

View File

@ -16,7 +16,7 @@ RSpec.describe Admin::Disputes::AppealsController do
let(:appeal) { Fabricate(:appeal, strike: strike, account: target_account) } let(:appeal) { Fabricate(:appeal, strike: strike, account: target_account) }
describe 'GET #index' do describe 'GET #index' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before { appeal } before { appeal }
@ -32,7 +32,7 @@ RSpec.describe Admin::Disputes::AppealsController do
describe 'POST #approve' do describe 'POST #approve' do
subject { post :approve, params: { id: appeal.id } } subject { post :approve, params: { id: appeal.id } }
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
it 'redirects back to the strike page and notifies target account about approved appeal', :inline_jobs do it 'redirects back to the strike page and notifies target account about approved appeal', :inline_jobs do
emails = capture_emails { subject } emails = capture_emails { subject }
@ -56,7 +56,7 @@ RSpec.describe Admin::Disputes::AppealsController do
describe 'POST #reject' do describe 'POST #reject' do
subject { post :reject, params: { id: appeal.id } } subject { post :reject, params: { id: appeal.id } }
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
it 'redirects back to the strike page and notifies target account about rejected appeal', :inline_jobs do it 'redirects back to the strike page and notifies target account about rejected appeal', :inline_jobs do
emails = capture_emails { subject } emails = capture_emails { subject }

View File

@ -6,7 +6,7 @@ RSpec.describe Admin::DomainBlocksController do
render_views render_views
before do before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
describe 'GET #new' do describe 'GET #new' do

View File

@ -6,7 +6,7 @@ RSpec.describe Admin::EmailDomainBlocksController do
render_views render_views
before do before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
describe 'GET #index' do describe 'GET #index' do

View File

@ -6,7 +6,7 @@ RSpec.describe Admin::ExportDomainAllowsController do
render_views render_views
before do before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
describe 'GET #new' do describe 'GET #new' do

View File

@ -6,7 +6,7 @@ RSpec.describe Admin::ExportDomainBlocksController do
render_views render_views
before do before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
describe 'GET #new' do describe 'GET #new' do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::FollowRecommendationsController do RSpec.describe Admin::FollowRecommendationsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::InstancesController do RSpec.describe Admin::InstancesController do
render_views render_views
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
let!(:account_popular_main) { Fabricate(:account, domain: 'popular') } let!(:account_popular_main) { Fabricate(:account, domain: 'popular') }

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::RelationshipsController do RSpec.describe Admin::RelationshipsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::Reports::ActionsController do RSpec.describe Admin::Reports::ActionsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::ReportsController do RSpec.describe Admin::ReportsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -7,7 +7,7 @@ RSpec.describe Admin::Settings::BrandingController do
describe 'When signed in as an admin' do describe 'When signed in as an admin' do
before do before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
describe 'PUT #update' do describe 'PUT #update' do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::SiteUploadsController do RSpec.describe Admin::SiteUploadsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::StatusesController do RSpec.describe Admin::StatusesController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }
let!(:status) { Fabricate(:status, account: account) } let!(:status) { Fabricate(:status, account: account) }
let(:media_attached_status) { Fabricate(:status, account: account, sensitive: !sensitive) } let(:media_attached_status) { Fabricate(:status, account: account, sensitive: !sensitive) }

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::TermsOfService::DistributionsController do RSpec.describe Admin::TermsOfService::DistributionsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:terms_of_service) { Fabricate(:terms_of_service, notification_sent_at: nil) } let(:terms_of_service) { Fabricate(:terms_of_service, notification_sent_at: nil) }
before do before do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::TermsOfService::DraftsController do RSpec.describe Admin::TermsOfService::DraftsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::TermsOfService::GeneratesController do RSpec.describe Admin::TermsOfService::GeneratesController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::TermsOfService::HistoriesController do RSpec.describe Admin::TermsOfService::HistoriesController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::TermsOfService::PreviewsController do RSpec.describe Admin::TermsOfService::PreviewsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:terms_of_service) { Fabricate(:terms_of_service, notification_sent_at: nil) } let(:terms_of_service) { Fabricate(:terms_of_service, notification_sent_at: nil) }
before do before do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::TermsOfService::TestsController do RSpec.describe Admin::TermsOfService::TestsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:terms_of_service) { Fabricate(:terms_of_service, notification_sent_at: nil) } let(:terms_of_service) { Fabricate(:terms_of_service, notification_sent_at: nil) }
before do before do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::TermsOfServiceController do RSpec.describe Admin::TermsOfServiceController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::Trends::Links::PreviewCardProvidersController do RSpec.describe Admin::Trends::Links::PreviewCardProvidersController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::Trends::LinksController do RSpec.describe Admin::Trends::LinksController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::Trends::StatusesController do RSpec.describe Admin::Trends::StatusesController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::Trends::TagsController do RSpec.describe Admin::Trends::TagsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -9,7 +9,7 @@ RSpec.describe Admin::Users::TwoFactorAuthenticationsController do
let(:user) { Fabricate(:user) } let(:user) { Fabricate(:user) }
before do before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
describe 'DELETE #destroy' do describe 'DELETE #destroy' do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::WarningPresetsController do RSpec.describe Admin::WarningPresetsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe Admin::Webhooks::SecretsController do RSpec.describe Admin::Webhooks::SecretsController do
render_views render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before do before do
sign_in user, scope: :user sign_in user, scope: :user

View File

@ -13,3 +13,15 @@ Fabricator(:user) do
current_sign_in_at { Time.zone.now } current_sign_in_at { Time.zone.now }
agreement true agreement true
end end
Fabricator(:admin_user, from: :user) do
role UserRole.find_by(name: 'Admin')
end
Fabricator(:moderator_user, from: :user) do
role UserRole.find_by(name: 'Moderator')
end
Fabricator(:owner_user, from: :user) do
role UserRole.find_by(name: 'Owner')
end

View File

@ -8,7 +8,7 @@ RSpec.describe Admin::AccountAction do
describe '#save!' do describe '#save!' do
subject { account_action.save! } 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(:target_account) { Fabricate(:account) }
let(:type) { 'disable' } let(:type) { 'disable' }

View File

@ -8,7 +8,7 @@ RSpec.describe Form::AccountBatch do
describe '#save' do describe '#save' do
subject { account_batch.save } 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(:account_ids) { [] }
let(:query) { Account.none } let(:query) { Account.none }

View File

@ -7,7 +7,7 @@ RSpec.describe Form::CustomEmojiBatch do
subject { described_class.new({ current_account: account }.merge(options)) } subject { described_class.new({ current_account: account }.merge(options)) }
let(: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 context 'with empty custom_emoji_ids' do
let(:options) { { custom_emoji_ids: [] } } let(:options) { { custom_emoji_ids: [] } }

View File

@ -601,7 +601,7 @@ RSpec.describe User do
end end
describe '.those_who_can' do 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 context 'when there are not any user roles' do
before { UserRole.destroy_all } before { UserRole.destroy_all }
@ -618,7 +618,7 @@ RSpec.describe User do
end end
context 'when there are users with roles' do 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 it 'returns the users with the role' do
expect(described_class.those_who_can(:manage_blocks)).to eq([admin_user]) expect(described_class.those_who_can(:manage_blocks)).to eq([admin_user])

View File

@ -18,7 +18,7 @@ RSpec.describe Webhook do
subject { Fabricate.build :webhook, current_account: account } subject { Fabricate.build :webhook, current_account: account }
context 'with account that has permissions' do 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) } it { is_expected.to allow_values(%w(account.created)).for(:events) }
end end

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe AccountModerationNotePolicy do RSpec.describe AccountModerationNotePolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :create? do permissions :create? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe AccountPolicy do RSpec.describe AccountPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
let(:alice) { Fabricate(:account) } let(:alice) { Fabricate(:account) }
@ -70,7 +70,7 @@ RSpec.describe AccountPolicy do
end end
permissions :suspend?, :silence? do permissions :suspend?, :silence? do
let(:staff) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:staff) { Fabricate(:admin_user).account }
context 'when staff' do context 'when staff' do
context 'when record is staff' do context 'when record is staff' do
@ -94,7 +94,7 @@ RSpec.describe AccountPolicy do
end end
permissions :memorialize? do permissions :memorialize? do
let(:other_admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:other_admin) { Fabricate(:admin_user).account }
context 'when admin' do context 'when admin' do
context 'when record is admin' do context 'when record is admin' do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe AccountWarningPolicy do RSpec.describe AccountWarningPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }
permissions :show? do permissions :show? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe AccountWarningPresetPolicy do RSpec.describe AccountWarningPresetPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :create?, :update?, :destroy? do permissions :index?, :create?, :update?, :destroy? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe Admin::StatusPolicy do RSpec.describe Admin::StatusPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
let(:status) { Fabricate(:status, visibility: status_visibility) } let(:status) { Fabricate(:status, visibility: status_visibility) }
let(:status_visibility) { :public } let(:status_visibility) { :public }

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe AnnouncementPolicy do RSpec.describe AnnouncementPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :create?, :update?, :destroy? do permissions :index?, :create?, :update?, :destroy? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe AppealPolicy do RSpec.describe AppealPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
let(:appeal) { Fabricate(:appeal) } let(:appeal) { Fabricate(:appeal) }

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe AuditLogPolicy do RSpec.describe AuditLogPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }
permissions :index? do permissions :index? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe CanonicalEmailBlockPolicy do RSpec.describe CanonicalEmailBlockPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :show?, :test?, :create?, :destroy? do permissions :index?, :show?, :test?, :create?, :destroy? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe CustomEmojiPolicy do RSpec.describe CustomEmojiPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :enable?, :disable? do permissions :index?, :enable?, :disable? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe DashboardPolicy do RSpec.describe DashboardPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }
permissions :index? do permissions :index? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe DeliveryPolicy do RSpec.describe DeliveryPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :clear_delivery_errors?, :restart_delivery?, :stop_delivery? do permissions :clear_delivery_errors?, :restart_delivery?, :stop_delivery? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe DomainAllowPolicy do RSpec.describe DomainAllowPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :show?, :create?, :destroy? do permissions :index?, :show?, :create?, :destroy? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe DomainBlockPolicy do RSpec.describe DomainBlockPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :show?, :create?, :destroy?, :update? do permissions :index?, :show?, :create?, :destroy?, :update? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe EmailDomainBlockPolicy do RSpec.describe EmailDomainBlockPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :show?, :create?, :destroy? do permissions :index?, :show?, :create?, :destroy? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe FollowRecommendationPolicy do RSpec.describe FollowRecommendationPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :show?, :suppress?, :unsuppress? do permissions :show?, :suppress?, :unsuppress? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe InstancePolicy do RSpec.describe InstancePolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :show?, :destroy? do permissions :index?, :show?, :destroy? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe InvitePolicy do RSpec.describe InvitePolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:user).account } let(:john) { Fabricate(:user).account }
permissions :index? do permissions :index? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe IpBlockPolicy do RSpec.describe IpBlockPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :show?, :create?, :update?, :destroy? do permissions :index?, :show?, :create?, :update?, :destroy? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe PreviewCardPolicy do RSpec.describe PreviewCardPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :review? do permissions :index?, :review? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe PreviewCardProviderPolicy do RSpec.describe PreviewCardProviderPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :review? do permissions :index?, :review? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe RelayPolicy do RSpec.describe RelayPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :update? do permissions :update? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe ReportNotePolicy do RSpec.describe ReportNotePolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :create? do permissions :create? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe ReportPolicy do RSpec.describe ReportPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :update?, :index?, :show? do permissions :update?, :index?, :show? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe RulePolicy do RSpec.describe RulePolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :create?, :update?, :destroy? do permissions :index?, :create?, :update?, :destroy? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe SettingsPolicy do RSpec.describe SettingsPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :update?, :show?, :destroy? do permissions :update?, :show?, :destroy? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe SoftwareUpdatePolicy do RSpec.describe SoftwareUpdatePolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')).account } let(:admin) { Fabricate(:owner_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index? do permissions :index? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe StatusPolicy, type: :model do RSpec.describe StatusPolicy, type: :model do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:admin) { Fabricate(:admin_user) }
let(:alice) { Fabricate(:account, username: 'alice') } let(:alice) { Fabricate(:account, username: 'alice') }
let(:bob) { Fabricate(:account, username: 'bob') } let(:bob) { Fabricate(:account, username: 'bob') }
let(:status) { Fabricate(:status, account: alice) } let(:status) { Fabricate(:status, account: alice) }

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe TagPolicy do RSpec.describe TagPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :show?, :update?, :review? do permissions :index?, :show?, :update?, :review? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe TermsOfServicePolicy do RSpec.describe TermsOfServicePolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :create? do permissions :index?, :create? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe UserPolicy do RSpec.describe UserPolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :reset_password?, :change_email? do permissions :reset_password?, :change_email? do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe UserRolePolicy do RSpec.describe UserRolePolicy do
subject { described_class } subject { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }
permissions :index?, :create? do permissions :index?, :create? do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe WebhookPolicy do RSpec.describe WebhookPolicy do
let(:policy) { described_class } let(:policy) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:admin) { Fabricate(:admin_user).account }
let(:john) { Fabricate(:account) } let(:john) { Fabricate(:account) }
permissions :index?, :create? do permissions :index?, :create? do

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin Dimensions' do RSpec.describe 'Admin Dimensions' do
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) } let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin Measures' do RSpec.describe 'Admin Measures' do
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) } let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin Retention' do RSpec.describe 'Admin Retention' do
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) } let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }

View File

@ -13,7 +13,7 @@ RSpec.describe 'Reports' do
post '/api/v1/reports', headers: headers, params: params post '/api/v1/reports', headers: headers, params: params
end end
let!(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let!(:admin) { Fabricate(:admin_user) }
let(:status) { Fabricate(:status) } let(:status) { Fabricate(:status) }
let(:target_account) { status.account } let(:target_account) { status.account }
let(:category) { 'other' } let(:category) { 'other' }

View File

@ -172,7 +172,7 @@ RSpec.describe 'Caching behavior' do
before_all do before_all do
alice = Fabricate(:account, username: 'alice') alice = Fabricate(:account, username: 'alice')
user = Fabricate(:user, email: 'user@host.example', role: UserRole.find_by(name: 'Moderator')) user = Fabricate(:moderator_user, email: 'user@host.example')
status = Fabricate(:status, account: alice, id: 110_224_538_612_341_312) status = Fabricate(:status, account: alice, id: 110_224_538_612_341_312)
Fabricate(:status, account: alice, id: 110_224_538_643_211_312, visibility: :private) Fabricate(:status, account: alice, id: 110_224_538_643_211_312, visibility: :private)
Fabricate(:invite, code: 'abcdef') Fabricate(:invite, code: 'abcdef')

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe AppealService, :inline_jobs do RSpec.describe AppealService, :inline_jobs do
describe '#call' do describe '#call' do
let!(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let!(:admin) { Fabricate(:admin_user) }
context 'with an existing strike' do context 'with an existing strike' do
let(:strike) { Fabricate(:account_warning) } let(:strike) { Fabricate(:account_warning) }

View File

@ -9,7 +9,7 @@ RSpec.describe SoftwareUpdateCheckService do
let(:full_update_check_url) { "#{update_check_url}?version=#{Mastodon::Version.to_s.split('+')[0]}" } let(:full_update_check_url) { "#{update_check_url}?version=#{Mastodon::Version.to_s.split('+')[0]}" }
let(:devops_role) { Fabricate(:user_role, name: 'DevOps', permissions: UserRole::FLAGS[:view_devops]) } let(:devops_role) { Fabricate(:user_role, name: 'DevOps', permissions: UserRole::FLAGS[:view_devops]) }
let(:owner_user) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')) } let(:owner_user) { Fabricate(:owner_user) }
let(:old_devops_user) { Fabricate(:user) } let(:old_devops_user) { Fabricate(:user) }
let(:none_user) { Fabricate(:user, role: devops_role) } let(:none_user) { Fabricate(:user, role: devops_role) }
let(:patch_user) { Fabricate(:user, role: devops_role) } let(:patch_user) { Fabricate(:user, role: devops_role) }

View File

@ -2,7 +2,7 @@
module SystemHelpers module SystemHelpers
def admin_user def admin_user
Fabricate(:user, role: UserRole.find_by(name: 'Admin')) Fabricate(:admin_user)
end end
def submit_button def submit_button

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::AccountModerationNotes' do RSpec.describe 'Admin::AccountModerationNotes' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
let(:target_account) { Fabricate(:account) } let(:target_account) { Fabricate(:account) }
before { sign_in current_user } before { sign_in current_user }

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::Accounts' do RSpec.describe 'Admin::Accounts' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before do before do
sign_in current_user sign_in current_user

View File

@ -121,6 +121,6 @@ RSpec.describe 'Admin::Announcements' do
end end
def admin_user def admin_user
Fabricate(:user, role: UserRole.find_by(name: 'Admin')) Fabricate(:admin_user)
end end
end end

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::CustomEmojis' do RSpec.describe 'Admin::CustomEmojis' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before { sign_in current_user } before { sign_in current_user }

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::DomainAllows' do RSpec.describe 'Admin::DomainAllows' do
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
let(:domain) { 'host.example' } let(:domain) { 'host.example' }
before do before do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe 'blocking domains through the moderation interface' do RSpec.describe 'blocking domains through the moderation interface' do
before do before do
allow(DomainBlockWorker).to receive(:perform_async).and_return(true) allow(DomainBlockWorker).to receive(:perform_async).and_return(true)
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user sign_in Fabricate(:admin_user), scope: :user
end end
context 'when silencing a new domain' do context 'when silencing a new domain' do

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::EmailDomainBlocks' do RSpec.describe 'Admin::EmailDomainBlocks' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before do before do
sign_in current_user sign_in current_user

View File

@ -6,7 +6,7 @@ RSpec.describe 'Admin Invites' do
describe 'Invite interaction' do describe 'Invite interaction' do
let!(:invite) { Fabricate(:invite, expires_at: nil) } let!(:invite) { Fabricate(:invite, expires_at: nil) }
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before { sign_in user } before { sign_in user }

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::IpBlocks' do RSpec.describe 'Admin::IpBlocks' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before { sign_in current_user } before { sign_in current_user }

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe 'Admin Relays' do RSpec.describe 'Admin Relays' do
describe 'Managing relays' do describe 'Managing relays' do
before { sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } before { sign_in Fabricate(:admin_user) }
describe 'Viewing relays' do describe 'Viewing relays' do
let!(:relay) { Fabricate :relay } let!(:relay) { Fabricate :relay }

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin Report Notes' do RSpec.describe 'Admin Report Notes' do
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:user) { Fabricate(:admin_user) }
before { sign_in user } before { sign_in user }

View File

@ -28,7 +28,7 @@ RSpec.describe 'Admin::Reset' do
end end
def admin_user def admin_user
Fabricate(:user, role: UserRole.find_by(name: 'Admin')) Fabricate(:admin_user)
end end
def submit_reset def submit_reset

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe 'Admin Rules' do RSpec.describe 'Admin Rules' do
describe 'Managing rules' do describe 'Managing rules' do
before { sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } before { sign_in Fabricate(:admin_user) }
describe 'Viewing rules' do describe 'Viewing rules' do
let!(:rule) { Fabricate :rule, text: 'This is a rule' } let!(:rule) { Fabricate :rule, text: 'This is a rule' }

View File

@ -6,7 +6,7 @@ RSpec.describe 'finding software updates through the admin interface' do
before do before do
Fabricate(:software_update, version: '99.99.99', type: 'major', urgent: true, release_notes: 'https://github.com/mastodon/mastodon/releases/v99') Fabricate(:software_update, version: '99.99.99', type: 'major', urgent: true, release_notes: 'https://github.com/mastodon/mastodon/releases/v99')
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Owner')), scope: :user sign_in Fabricate(:owner_user), scope: :user
end end
it 'shows a link to the software updates page, which links to release notes' do it 'shows a link to the software updates page, which links to release notes' do

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::Statuses' do RSpec.describe 'Admin::Statuses' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before do before do
sign_in current_user sign_in current_user

View File

@ -6,7 +6,7 @@ RSpec.describe 'Admin Tags' do
describe 'Tag interaction' do describe 'Tag interaction' do
let!(:tag) { Fabricate(:tag, name: 'test') } let!(:tag) { Fabricate(:tag, name: 'test') }
before { sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } before { sign_in Fabricate(:admin_user) }
it 'allows tags listing and editing' do it 'allows tags listing and editing' do
visit admin_tags_path visit admin_tags_path

View File

@ -6,7 +6,7 @@ RSpec.describe 'Admin Terms of services' do
describe 'Viewing terms of services index page' do describe 'Viewing terms of services index page' do
let!(:terms) { Fabricate :terms_of_service, text: 'Test terms' } let!(:terms) { Fabricate :terms_of_service, text: 'Test terms' }
before { sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } before { sign_in Fabricate(:admin_user) }
it 'allows tags listing and editing' do it 'allows tags listing and editing' do
visit admin_terms_of_service_index_path visit admin_terms_of_service_index_path

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::Trends::Links::PreviewCardProviders' do RSpec.describe 'Admin::Trends::Links::PreviewCardProviders' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before do before do
sign_in current_user sign_in current_user

View File

@ -3,7 +3,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Admin::Trends::Links' do RSpec.describe 'Admin::Trends::Links' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } let(:current_user) { Fabricate(:admin_user) }
before do before do
sign_in current_user sign_in current_user

Some files were not shown because too many files have changed in this diff Show More