diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-09 09:12:53 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-09 09:12:53 +0000 |
commit | 981fbc21b05638fa14911ee8fe8bc3fb39c025b8 (patch) | |
tree | 999321f5e38d1689c540f4e8f1fc9781e6692c50 | |
parent | bd741f3043fd161ea7ced12bcd1b391bce610708 (diff) | |
parent | ae5480783abce7f4e340a749bded666c2ef7ff29 (diff) | |
download | gitlab-ce-981fbc21b05638fa14911ee8fe8bc3fb39c025b8.tar.gz |
Merge branch '7047-fix-user-creation-error-from-admin-ce' into 'master'
Backport of EE "catch entering username as an email instead of returning a 500 error"
See merge request gitlab-org/gitlab-ce!21085
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index 6c194c9a646..1db6c75b85b 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -68,10 +68,12 @@ describe "Admin::Users" do end describe "GET /admin/users/new" do + let(:user_username) { 'bang' } + before do visit new_admin_user_path fill_in "user_name", with: "Big Bang" - fill_in "user_username", with: "bang" + fill_in "user_username", with: user_username fill_in "user_email", with: "bigbang@mail.com" end @@ -112,6 +114,17 @@ describe "Admin::Users" do expect(email.text_part.body).to have_content(user.email) expect(email.text_part.body).to have_content('password') end + + context 'username contains spaces' do + let(:user_username) { 'Bing bang' } + + it "doesn't create the user and shows an error message" do + expect { click_button "Create user" }.to change {User.count}.by(0) + + expect(page).to have_content('The form contains the following error') + expect(page).to have_content('Username can contain only letters, digits') + end + end end describe "GET /admin/users/:id" do |