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
This commit is contained in:
commit
981fbc21b0
1 changed files with 14 additions and 1 deletions
|
@ -68,10 +68,12 @@ describe "Admin::Users" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /admin/users/new" do
|
describe "GET /admin/users/new" do
|
||||||
|
let(:user_username) { 'bang' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
visit new_admin_user_path
|
visit new_admin_user_path
|
||||||
fill_in "user_name", with: "Big Bang"
|
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"
|
fill_in "user_email", with: "bigbang@mail.com"
|
||||||
end
|
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(user.email)
|
||||||
expect(email.text_part.body).to have_content('password')
|
expect(email.text_part.body).to have_content('password')
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "GET /admin/users/:id" do
|
describe "GET /admin/users/:id" do
|
||||||
|
|
Loading…
Reference in a new issue