diff options
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/project_settings_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/projects/user_creates_project_spec.rb | 31 | ||||
-rw-r--r-- | spec/features/projects/user_transfers_a_project_spec.rb | 49 |
3 files changed, 85 insertions, 1 deletions
diff --git a/spec/features/projects/project_settings_spec.rb b/spec/features/projects/project_settings_spec.rb index 15a5cd9990b..a3ea778d401 100644 --- a/spec/features/projects/project_settings_spec.rb +++ b/spec/features/projects/project_settings_spec.rb @@ -144,7 +144,10 @@ describe 'Edit Project Settings' do specify 'the project is accessible via the new path' do transfer_project(project, group) new_path = namespace_project_path(group, project) + visit new_path + wait_for_requests + expect(current_path).to eq(new_path) expect(find('.breadcrumbs')).to have_content(project.name) end @@ -153,7 +156,10 @@ describe 'Edit Project Settings' do old_path = project_path(project) transfer_project(project, group) new_path = namespace_project_path(group, project) + visit old_path + wait_for_requests + expect(current_path).to eq(new_path) expect(find('.breadcrumbs')).to have_content(project.name) end diff --git a/spec/features/projects/user_creates_project_spec.rb b/spec/features/projects/user_creates_project_spec.rb index 4a152572502..f95469ad070 100644 --- a/spec/features/projects/user_creates_project_spec.rb +++ b/spec/features/projects/user_creates_project_spec.rb @@ -6,10 +6,11 @@ feature 'User creates a project', :js do before do sign_in(user) create(:personal_key, user: user) - visit(new_project_path) end it 'creates a new project' do + visit(new_project_path) + fill_in(:project_path, with: 'Empty') page.within('#content-body') do @@ -24,4 +25,32 @@ feature 'User creates a project', :js do expect(page).to have_content('git remote') expect(page).to have_content(project.url_to_repo) end + + context 'in a subgroup they do not own', :nested_groups do + let(:parent) { create(:group) } + let!(:subgroup) { create(:group, parent: parent) } + + before do + parent.add_owner(user) + end + + it 'creates a new project' do + visit(new_project_path) + + fill_in :project_path, with: 'a-subgroup-project' + + page.find('.js-select-namespace').click + page.find("div[role='option']", text: subgroup.full_path).click + + page.within('#content-body') do + click_button('Create project') + end + + expect(page).to have_content("Project 'a-subgroup-project' was successfully created") + + project = Project.last + + expect(project.namespace).to eq(subgroup) + end + end end diff --git a/spec/features/projects/user_transfers_a_project_spec.rb b/spec/features/projects/user_transfers_a_project_spec.rb new file mode 100644 index 00000000000..78f72b644ff --- /dev/null +++ b/spec/features/projects/user_transfers_a_project_spec.rb @@ -0,0 +1,49 @@ +require 'spec_helper' + +feature 'User transfers a project', :js do + let(:user) { create(:user) } + let(:project) { create(:project, :repository, namespace: user.namespace) } + + before do + sign_in user + end + + def transfer_project(project, group) + visit edit_project_path(project) + + page.within('.js-project-transfer-form') do + page.find('.select2-container').click + end + + page.find("div[role='option']", text: group.full_name).click + + click_button('Transfer project') + + fill_in 'confirm_name_input', with: project.name + + click_button 'Confirm' + + wait_for_requests + end + + it 'allows transferring a project to a subgroup of a namespace' do + group = create(:group) + group.add_owner(user) + + transfer_project(project, group) + + expect(project.reload.namespace).to eq(group) + end + + context 'when nested groups are available', :nested_groups do + it 'allows transferring a project to a subgroup' do + parent = create(:group) + parent.add_owner(user) + subgroup = create(:group, parent: parent) + + transfer_project(project, subgroup) + + expect(project.reload.namespace).to eq(subgroup) + end + end +end |