Add failing feature spec detailing a maintainer creating a subgroup

- Change the two existing feature examples that create a subgroup to
  elucidate that the owner is creating the subgroup

- Nest two more specs inside the 'subgroup support' context detailing
  what happens when a maintainer attempts to add a subgroup (one with
  subgroup support, and one without)
This commit is contained in:
Fabio Papa 2019-06-14 15:16:55 -07:00
parent 7b958537fd
commit 3cbca3776c
1 changed files with 48 additions and 13 deletions

View File

@ -56,11 +56,17 @@ describe 'Group show page' do
end
context 'subgroup support' do
let(:user) { create(:user) }
let(:owner) { create(:user) }
let(:maintainer) { create(:user) }
before do
group.add_owner(user)
sign_in(user)
group.add_owner(owner)
group.add_maintainer(maintainer)
end
context 'for owners' do
before do
sign_in(owner)
end
context 'when subgroups are supported', :js, :nested_groups do
@ -86,6 +92,35 @@ describe 'Group show page' do
end
end
context 'for maintainers' do
before do
sign_in(maintainer)
end
context 'when subgroups are supported', :js, :nested_groups do
before do
allow(Group).to receive(:supports_nested_objects?) { true }
visit path
end
it 'allows creating subgroups' do
expect(page).to have_css("li[data-text='New subgroup']", visible: false)
end
end
context 'when subgroups are not supported' do
before do
allow(Group).to receive(:supports_nested_objects?) { false }
visit path
end
it 'allows creating subgroups' do
expect(page).not_to have_selector("li[data-text='New subgroup']", visible: false)
end
end
end
end
context 'group has a project with emoji in description', :js do
let(:user) { create(:user) }
let!(:project) { create(:project, description: ':smile:', namespace: group) }