logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

suspensions_controller_spec.rb (830B)


  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