summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 12:08:10 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 12:08:10 +0000
commitb86f474bf51e20d2db4cf0895d0a8e0894e31c08 (patch)
tree061d2a4c749924f5a35fe6199dd1d8982c4b0b27 /spec/views
parent6b8040dc25fdc5fe614c3796a147517dd50bc7d8 (diff)
downloadgitlab-ce-b86f474bf51e20d2db4cf0895d0a8e0894e31c08.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/admin/sessions/new.html.haml_spec.rb35
-rw-r--r--spec/views/layouts/application.html.haml_spec.rb1
2 files changed, 26 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
diff --git a/spec/views/layouts/application.html.haml_spec.rb b/spec/views/layouts/application.html.haml_spec.rb
index bdd4a97a1f5..4270bbf1924 100644
--- a/spec/views/layouts/application.html.haml_spec.rb
+++ b/spec/views/layouts/application.html.haml_spec.rb
@@ -11,6 +11,7 @@ describe 'layouts/application' do
allow(view).to receive(:session).and_return({})
allow(view).to receive(:user_signed_in?).and_return(true)
allow(view).to receive(:current_user).and_return(user)
+ allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user))
end
context 'body data elements for pageview context' do