0
0
Fork 0

Use the Admin::ActionLog fabricator in admin/action_logs spec (#28194)

This commit is contained in:
Matt Jankowski 2023-12-04 07:56:28 -05:00 committed by GitHub
parent b3b009e6aa
commit cca19f5fbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 34 deletions

View file

@ -9,11 +9,9 @@ describe Admin::ActionLogsController do
let!(:account) { Fabricate(:account) }
before do
_orphaned_logs = %w(
Account User UserRole Report DomainBlock DomainAllow
EmailDomainBlock UnavailableDomain Status AccountWarning
Announcement IpBlock Instance CustomEmoji CanonicalEmailBlock Appeal
).map { |type| Admin::ActionLog.new(account: account, action: 'destroy', target_type: type, target_id: 1312).save! }
orphaned_log_types.map do |type|
Fabricate(:action_log, account: account, action: 'destroy', target_type: type, target_id: 1312)
end
end
describe 'GET #index' do
@ -24,4 +22,27 @@ describe Admin::ActionLogsController do
expect(response).to have_http_status(200)
end
end
private
def orphaned_log_types
%w(
Account
AccountWarning
Announcement
Appeal
CanonicalEmailBlock
CustomEmoji
DomainAllow
DomainBlock
EmailDomainBlock
Instance
IpBlock
Report
Status
UnavailableDomain
User
UserRole
)
end
end