964ae8eee5
Allow access to account settings, 2FA, authorized applications, and account deletions to unconfirmed and pending users, as well as users who had their accounts disabled. Suspended users cannot update their e-mail or password or delete their account. Display account status on account settings page, for example, when an account is frozen, limited, unconfirmed or pending review. After sign up, login users straight away and show a simple page that tells them the status of their account with links to account settings and logout, to reduce onboarding friction and allow users to correct wrongly typed e-mail addresses. Move the final sign-up step of SSO integrations to be the same as above to reduce code duplication.
53 lines
1.6 KiB
Ruby
53 lines
1.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe Auth::ConfirmationsController, type: :controller do
|
|
render_views
|
|
|
|
describe 'GET #new' do
|
|
it 'returns http success' do
|
|
@request.env['devise.mapping'] = Devise.mappings[:user]
|
|
get :new
|
|
expect(response).to have_http_status(200)
|
|
end
|
|
end
|
|
|
|
describe 'GET #show' do
|
|
context 'when user is unconfirmed' do
|
|
let!(:user) { Fabricate(:user, confirmation_token: 'foobar', confirmed_at: nil) }
|
|
|
|
before do
|
|
allow(BootstrapTimelineWorker).to receive(:perform_async)
|
|
@request.env['devise.mapping'] = Devise.mappings[:user]
|
|
get :show, params: { confirmation_token: 'foobar' }
|
|
end
|
|
|
|
it 'redirects to login' do
|
|
expect(response).to redirect_to(new_user_session_path)
|
|
end
|
|
|
|
it 'queues up bootstrapping of home timeline' do
|
|
expect(BootstrapTimelineWorker).to have_received(:perform_async).with(user.account_id)
|
|
end
|
|
end
|
|
|
|
context 'when user is updating email' do
|
|
let!(:user) { Fabricate(:user, confirmation_token: 'foobar', unconfirmed_email: 'new-email@example.com') }
|
|
|
|
before do
|
|
allow(BootstrapTimelineWorker).to receive(:perform_async)
|
|
@request.env['devise.mapping'] = Devise.mappings[:user]
|
|
get :show, params: { confirmation_token: 'foobar' }
|
|
end
|
|
|
|
it 'redirects to login' do
|
|
expect(response).to redirect_to(new_user_session_path)
|
|
end
|
|
|
|
it 'does not queue up bootstrapping of home timeline' do
|
|
expect(BootstrapTimelineWorker).to_not have_received(:perform_async)
|
|
end
|
|
end
|
|
end
|
|
end
|