You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

  1. require 'rails_helper'
  2. describe Admin::SuspensionsController do
  3. render_views
  4. before do
  5. sign_in Fabricate(:user, admin: true), scope: :user
  6. end
  7. describe 'GET #new' do
  8. it 'returns 200' do
  9. get :new, params: { account_id: Fabricate(:account).id, report_id: Fabricate(:report).id }
  10. expect(response).to have_http_status(200)
  11. end
  12. end
  13. describe 'POST #create' do
  14. it 'redirects to admin accounts page' do
  15. account = Fabricate(:account, suspended: false)
  16. expect(Admin::SuspensionWorker).to receive(:perform_async).with(account.id)
  17. post :create, params: { account_id: account.id, form_admin_suspension_confirmation: { acct: account.acct } }
  18. expect(response).to redirect_to(admin_accounts_path)
  19. end
  20. end
  21. describe 'DELETE #destroy' do
  22. it 'redirects to admin accounts page' do
  23. account = Fabricate(:account, suspended: true)
  24. delete :destroy, params: { account_id: account.id }
  25. account.reload
  26. expect(account.suspended?).to eq false
  27. expect(response).to redirect_to(admin_accounts_path)
  28. end
  29. end
  30. end