summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-08-09 10:51:15 +0200
committerRémy Coutable <remy@rymai.me>2016-08-09 10:51:15 +0200
commit1ff92ed60bd73ce1663fb4776361b28699730308 (patch)
treeb530f3b1ff62c8b52783228da9e46fc3604492d4 /spec
parentdab5e045e061b208f6ecb7951553190745da988f (diff)
parented63ead22aa9fd9fe509f3bebd73223b4ff8b8c5 (diff)
downloadgitlab-ce-1ff92ed60bd73ce1663fb4776361b28699730308.tar.gz
Merge branch 'duduribeiro/gitlab-ce-current_password_when_auto_set'
See merge request !5712.
Diffstat (limited to 'spec')
-rw-r--r--spec/features/profiles/password_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/features/profiles/password_spec.rb b/spec/features/profiles/password_spec.rb
new file mode 100644
index 00000000000..4cbdd89d46f
--- /dev/null
+++ b/spec/features/profiles/password_spec.rb
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe 'Profile > Password', feature: true do
+ let(:user) { create(:user, password_automatically_set: true) }
+
+ before do
+ login_as(user)
+ visit edit_profile_password_path
+ end
+
+ def fill_passwords(password, confirmation)
+ fill_in 'New password', with: password
+ fill_in 'Password confirmation', with: confirmation
+
+ click_button 'Save password'
+ end
+
+ context 'User with password automatically set' do
+ describe 'User puts different passwords in the field and in the confirmation' do
+ it 'shows an error message' do
+ fill_passwords('mypassword', 'mypassword2')
+
+ page.within('.alert-danger') do
+ expect(page).to have_content("Password confirmation doesn't match Password")
+ end
+ end
+
+ it 'does not contains the current password field after an error' do
+ fill_passwords('mypassword', 'mypassword2')
+
+ expect(page).to have_no_field('user[current_password]')
+ end
+ end
+
+ describe 'User puts the same passwords in the field and in the confirmation' do
+ it 'shows a success message' do
+ fill_passwords('mypassword', 'mypassword')
+
+ page.within('.flash-notice') do
+ expect(page).to have_content('Password was successfully updated. Please login with it')
+ end
+ end
+ end
+ end
+end