resets_controller_spec.rb 620 B

12345678910111213141516171819202122232425
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Admin::ResetsController do
  4. render_views
  5. let(:account) { Fabricate(:account) }
  6. before do
  7. sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user
  8. end
  9. describe 'POST #create' do
  10. it 'redirects to admin accounts page' do
  11. expect_any_instance_of(User).to receive(:send_reset_password_instructions) do |value|
  12. expect(value.account_id).to eq account.id
  13. end
  14. post :create, params: { account_id: account.id }
  15. expect(response).to redirect_to(admin_account_path(account.id))
  16. end
  17. end
  18. end