resets_controller_spec.rb 575 B

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