闭社主体 forked from https://github.com/tootsuite/mastodon
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.

32 lines
830 B

  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 'POST #create' do
  8. it 'redirects to admin accounts page' do
  9. account = Fabricate(:account, suspended: false)
  10. expect(Admin::SuspensionWorker).to receive(:perform_async).with(account.id)
  11. post :create, params: { account_id: account.id }
  12. expect(response).to redirect_to(admin_accounts_path)
  13. end
  14. end
  15. describe 'DELETE #destroy' do
  16. it 'redirects to admin accounts page' do
  17. account = Fabricate(:account, suspended: true)
  18. delete :destroy, params: { account_id: account.id }
  19. account.reload
  20. expect(account.suspended?).to eq false
  21. expect(response).to redirect_to(admin_accounts_path)
  22. end
  23. end
  24. end