Commit 3613e342 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'dz-inherit-create-group-permission' into 'master'

Add more tests for subgroups feature

See merge request !10486
parents eba7c3c1 f51adf8c
No related merge requests found
......@@ -86,6 +86,7 @@ feature 'Group', feature: true do
describe 'create a nested group' do
let(:group) { create(:group, path: 'foo') }
context 'as admin' do
before do
visit subgroups_group_path(group)
click_link 'New Subgroup'
......@@ -100,6 +101,28 @@ feature 'Group', feature: true do
end
end
context 'as group owner' do
let(:user) { create(:user) }
before do
group.add_owner(user)
logout
login_as(user)
visit subgroups_group_path(group)
click_link 'New Subgroup'
end
it 'creates a nested group' do
fill_in 'Group path', with: 'bar'
click_button 'Create group'
expect(current_path).to eq(group_path('foo/bar'))
expect(page).to have_content("Group 'bar' was successfully created.")
end
end
end
it 'checks permissions to avoid exposing groups by parent_id' do
group = create(:group, :private, path: 'secret-group')
......
......@@ -71,6 +71,22 @@ feature "New project", feature: true do
end
end
end
context "with subgroup namespace" do
let(:group) { create(:group, :private, owner: user) }
let(:subgroup) { create(:group, parent: group) }
before do
group.add_master(user)
visit new_project_path(namespace_id: subgroup.id)
end
it "selects the group namespace" do
namespace = find("#project_namespace_id option[selected]")
expect(namespace.text).to eq subgroup.full_path
end
end
end
context 'Import project options' do
......
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