Add more tests for subgroups feature
* subgroup can be created by owner of the group * project can be created inside subgroup by owner of the group Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
fec40d78a7
commit
f51adf8c6e
2 changed files with 47 additions and 8 deletions
|
@ -86,17 +86,40 @@ feature 'Group', feature: true do
|
||||||
describe 'create a nested group' do
|
describe 'create a nested group' do
|
||||||
let(:group) { create(:group, path: 'foo') }
|
let(:group) { create(:group, path: 'foo') }
|
||||||
|
|
||||||
before do
|
context 'as admin' do
|
||||||
visit subgroups_group_path(group)
|
before do
|
||||||
click_link 'New Subgroup'
|
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 'creates a nested group' do
|
context 'as group owner' do
|
||||||
fill_in 'Group path', with: 'bar'
|
let(:user) { create(:user) }
|
||||||
click_button 'Create group'
|
|
||||||
|
|
||||||
expect(current_path).to eq(group_path('foo/bar'))
|
before do
|
||||||
expect(page).to have_content("Group 'bar' was successfully created.")
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,22 @@ feature "New project", feature: true do
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
context 'Import project options' do
|
context 'Import project options' do
|
||||||
|
|
Loading…
Reference in a new issue