Commit f44d48a0 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '42774-new-trial-creation-fails-if-group-url-is-already-taken' into 'master'

New trial creation fails if group URL is already taken

See merge request gitlab-org/gitlab!22147
parents a3c0f9ca b6c4dce0
...@@ -91,7 +91,7 @@ class TrialsController < ApplicationController ...@@ -91,7 +91,7 @@ class TrialsController < ApplicationController
def create_group def create_group
name = sanitize(params[:new_group_name]) name = sanitize(params[:new_group_name])
group = Groups::CreateService.new(current_user, name: name, path: name.parameterize).execute group = Groups::CreateService.new(current_user, name: name, path: Namespace.clean_path(name.parameterize)).execute
params[:namespace_id] = group.id if group.persisted? params[:namespace_id] = group.id if group.persisted?
......
---
title: Uniquifies path slug creation from trial new group name
merge_request: 22147
author:
type: added
...@@ -64,16 +64,21 @@ describe 'Trial Select Namespace', :js do ...@@ -64,16 +64,21 @@ describe 'Trial Select Namespace', :js do
context 'enters an existing group name' do context 'enters an existing group name' do
let!(:namespace) { create(:namespace, owner_id: user.id, path: 'gitlab') } let!(:namespace) { create(:namespace, owner_id: user.id, path: 'gitlab') }
it 'shows validation error' do before do
expect_any_instance_of(GitlabSubscriptions::ApplyTrialService).to receive(:execute) do
{ success: true }
end
end
it 'proceeds to the next step with a unique url' do
fill_in 'New Group Name', with: namespace.path fill_in 'New Group Name', with: namespace.path
click_button 'Start your free trial' click_button 'Start your free trial'
wait_for_requests wait_for_requests
expect(page).to have_selector('.flash-text') expect(page).not_to have_css('flash-container')
expect(find('.flash-alert')).to have_text('Group URL has already been taken') expect(current_path).to eq('/gitlab1')
expect(current_path).to eq(apply_trials_path)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment