logo

mastofe

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

confirmations_controller_spec.rb (904B)


  1. require 'rails_helper'
  2. RSpec.describe Admin::ConfirmationsController, type: :controller 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 'confirms the user' do
  9. account = Fabricate(:account)
  10. user = Fabricate(:user, confirmed_at: false, account: account)
  11. post :create, params: { account_id: account.id }
  12. expect(response).to redirect_to(admin_accounts_path)
  13. expect(user.reload).to be_confirmed
  14. end
  15. it 'raises an error when there is no account' do
  16. post :create, params: { account_id: 'fake' }
  17. expect(response).to have_http_status(:missing)
  18. end
  19. it 'raises an error when there is no user' do
  20. account = Fabricate(:account, user: nil)
  21. post :create, params: { account_id: account.id }
  22. expect(response).to have_http_status(:missing)
  23. end
  24. end
  25. end