diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 15:08:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 15:08:10 +0300 |
commit | b86f474bf51e20d2db4cf0895d0a8e0894e31c08 (patch) | |
tree | 061d2a4c749924f5a35fe6199dd1d8982c4b0b27 /spec/views/admin | |
parent | 6b8040dc25fdc5fe614c3796a147517dd50bc7d8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views/admin')
-rw-r--r-- | spec/views/admin/sessions/new.html.haml_spec.rb | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/spec/views/admin/sessions/new.html.haml_spec.rb b/spec/views/admin/sessions/new.html.haml_spec.rb index 57255748988..b3208296c80 100644 --- a/spec/views/admin/sessions/new.html.haml_spec.rb +++ b/spec/views/admin/sessions/new.html.haml_spec.rb @@ -3,29 +3,44 @@ require 'spec_helper' describe 'admin/sessions/new.html.haml' do - context 'admin has password set' do - before do - allow(view).to receive(:password_authentication_enabled_for_web?).and_return(true) - end + let(:user) { create(:admin) } + + before do + allow(view).to receive(:current_user).and_return(user) + allow(view).to receive(:omniauth_enabled?).and_return(false) + end - it "shows enter password form" do + context 'internal admin user' do + it 'shows enter password form' do render expect(rendered).to have_css('#login-pane.active') expect(rendered).to have_selector('input[name="password"]') end + + it 'warns authentication not possible if password not set' do + allow(user).to receive(:require_password_creation_for_web?).and_return(true) + + render + + expect(rendered).not_to have_css('#login-pane') + expect(rendered).to have_content _('No authentication methods configured.') + end end - context 'admin has no password set' do + context 'omniauth authentication enabled' do before do - allow(view).to receive(:password_authentication_enabled_for_web?).and_return(false) + allow(view).to receive(:omniauth_enabled?).and_return(true) + allow(view).to receive(:button_based_providers_enabled?).and_return(true) end - it "warns authentication not possible" do + it 'shows omniauth form' do render - expect(rendered).not_to have_css('#login-pane') - expect(rendered).to have_content 'No authentication methods configured' + expect(rendered).to have_css('.omniauth-container') + expect(rendered).to have_content _('Sign in with') + + expect(rendered).not_to have_content _('No authentication methods configured.') end end end |