action_logs_controller_spec.rb 820 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Admin::ActionLogsController do
  4. render_views
  5. # Action logs typically cause issues when their targets are not in the database
  6. let!(:account) { Fabricate(:account) }
  7. let!(:orphaned_logs) do
  8. %w(
  9. Account User UserRole Report DomainBlock DomainAllow
  10. EmailDomainBlock UnavailableDomain Status AccountWarning
  11. Announcement IpBlock Instance CustomEmoji CanonicalEmailBlock Appeal
  12. ).map { |type| Admin::ActionLog.new(account: account, action: 'destroy', target_type: type, target_id: 1312).save! }
  13. end
  14. describe 'GET #index' do
  15. it 'returns 200' do
  16. sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin'))
  17. get :index, params: { page: 1 }
  18. expect(response).to have_http_status(200)
  19. end
  20. end
  21. end