1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/spec/controllers/admin/resets_controller_spec.rb

34 lines
927 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'rails_helper'
describe Admin::ResetsController do
render_views
let(:account) { Fabricate(:account) }
before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user
end
describe 'POST #create' do
it 'redirects to admin accounts page' do
2023-11-14 06:52:59 -08:00
expect do
post :create, params: { account_id: account.id }
end.to change(Devise.mailer.deliveries, :size).by(2)
2023-11-14 06:52:59 -08:00
expect(Devise.mailer.deliveries).to have_attributes(
first: have_attributes(
to: include(account.user.email),
subject: I18n.t('devise.mailer.password_change.subject')
),
last: have_attributes(
to: include(account.user.email),
subject: I18n.t('devise.mailer.reset_password_instructions.subject')
)
)
expect(response).to redirect_to(admin_account_path(account.id))
end
end
end