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:
authorRobert Speicher <rspeicher@gmail.com>2016-03-03 01:48:49 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-03-05 01:37:57 +0300
commit599a6d78737237e806dcfe0105b8b81dc696b71f (patch)
tree3bf899a3729ffcf36690634cc72e5a09ebf83061 /spec/features
parentec68d673b24687804b1e1aa4c86b2f8fbc9ba7fd (diff)
Allow the initial admin to set a password
Closes #1980
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/login_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb
index dac9205449a..4433ef2d6f1 100644
--- a/spec/features/login_spec.rb
+++ b/spec/features/login_spec.rb
@@ -1,6 +1,32 @@
require 'spec_helper'
feature 'Login', feature: true do
+ describe 'initial login after setup' do
+ it 'allows the initial admin to create a password' do
+ # This behavior is dependent on there only being one user
+ User.delete_all
+
+ user = create(:admin, password_automatically_set: true)
+
+ visit root_path
+ expect(current_path).to eq edit_user_password_path
+ expect(page).to have_content('Please create a password for your new account.')
+
+ fill_in 'user_password', with: 'password'
+ fill_in 'user_password_confirmation', with: 'password'
+ click_button 'Change your password'
+
+ expect(current_path).to eq new_user_session_path
+ expect(page).to have_content(I18n.t('devise.passwords.updated_not_active'))
+
+ fill_in 'user_login', with: user.username
+ fill_in 'user_password', with: 'password'
+ click_button 'Sign in'
+
+ expect(current_path).to eq root_path
+ end
+ end
+
describe 'with two-factor authentication' do
context 'with valid username/password' do
let(:user) { create(:user, :two_factor) }