Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/admin/sessions/new.html.haml_spec.rb')
-rw-r--r--spec/views/admin/sessions/new.html.haml_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/views/admin/sessions/new.html.haml_spec.rb b/spec/views/admin/sessions/new.html.haml_spec.rb
new file mode 100644
index 00000000000..eb431a0b6de
--- /dev/null
+++ b/spec/views/admin/sessions/new.html.haml_spec.rb
@@ -0,0 +1,29 @@
+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
+
+ it "shows enter password form" do
+ render
+
+ expect(rendered).to have_css('#login-pane.active')
+ expect(rendered).to have_selector('input[name="password"]')
+ end
+ end
+
+ context 'admin has no password set' do
+ before do
+ allow(view).to receive(:password_authentication_enabled_for_web?).and_return(false)
+ end
+
+ it "warns authentication not possible" do
+ render
+
+ expect(rendered).not_to have_css('#login-pane')
+ expect(rendered).to have_content 'No authentication methods configured'
+ end
+ end
+end