Commit 88183c5b authored by Fabio Papa's avatar Fabio Papa Committed by Imre Farkas

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)
parent 4f001b6d
...@@ -56,32 +56,67 @@ describe 'Group show page' do ...@@ -56,32 +56,67 @@ describe 'Group show page' do
end end
context 'subgroup support' do context 'subgroup support' do
let(:user) { create(:user) } let(:owner) { create(:user) }
let(:maintainer) { create(:user) }
before do before do
group.add_owner(user) group.add_owner(owner)
sign_in(user) group.add_maintainer(maintainer)
end end
context 'when subgroups are supported', :js, :nested_groups do context 'for owners' do
before do before do
allow(Group).to receive(:supports_nested_objects?) { true } sign_in(owner)
visit path
end end
it 'allows creating subgroups' do context 'when subgroups are supported', :js, :nested_groups do
expect(page).to have_css("li[data-text='New subgroup']", visible: false) 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 end
context 'when subgroups are not supported' do context 'for maintainers' do
before do before do
allow(Group).to receive(:supports_nested_objects?) { false } sign_in(maintainer)
visit path 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 end
it 'allows creating subgroups' do context 'when subgroups are not supported' do
expect(page).not_to have_selector("li[data-text='New subgroup']", visible: false) 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 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