summaryrefslogtreecommitdiff
path: root/spec/features/groups/show_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/groups/show_spec.rb')
-rw-r--r--spec/features/groups/show_spec.rb76
1 files changed, 69 insertions, 7 deletions
diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb
index 303013e59d5..8502d902e2e 100644
--- a/spec/features/groups/show_spec.rb
+++ b/spec/features/groups/show_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-feature 'Group show page' do
+feature 'Group show page', js: true do
let(:group) { create(:group) }
let(:path) { group_path(group) }
@@ -11,17 +11,79 @@ feature 'Group show page' do
before do
sign_in(user)
- visit path
end
- it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token"
+ it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token" do
+ before do
+ visit path
+ end
+ end
+
+ context 'subgroups', :nested_groups do
+ let!(:subgroup) { create(:group, parent: group) }
+ let!(:subsub_group) { create(:group, parent: subgroup) }
+ let!(:project) { create(:project, namespace: subsub_group) }
+
+ subject(:visit_subgroups) { visit subgroups_group_path(group) }
+
+ it 'only shows the direct children by default' do
+ visit_subgroups
+
+ expect(page).to have_selector('.groups-list-tree-container .group-list-tree', count: 1)
+ expect(page).to have_content(subgroup.name)
+ expect(page).not_to have_content(subsub_group.name)
+ end
+
+ context 'nested projects' do
+ def expand_groups
+ visit_subgroups
+
+ find("#group-#{subgroup.id}").trigger('click')
+ wait_for_requests
+
+ find("#group-#{subsub_group.id}").trigger('click')
+ wait_for_requests
+ end
+
+ it 'allows expanding to see a subgroups projects' do
+ expand_groups
+
+ expect(page).to have_content(project.name)
+ end
+
+ it 'shows a link to the group page if there are more than 10 projects' do
+ create_list(:project, 10, namespace: subsub_group)
+
+ expand_groups
+
+ expect(page).to have_link('1 more project')
+ end
+ end
+
+ describe 'filtering subgroups' do
+ let!(:other_subgroup) { create(:group, parent: group) }
+
+ it 'shows the parent of the group matching a search' do
+ visit_subgroups
+
+ expect(page).to have_content(subgroup.name)
+ expect(page).to have_content(other_subgroup.name)
+
+ fill_in 'filter_groups', with: subsub_group.name
+ wait_for_requests
+
+ expect(page).to have_content(subgroup.name)
+ expect(page).not_to have_content(other_subgroup.name)
+ end
+ end
+ end
end
context 'when signed out' do
- before do
- visit path
+ it_behaves_like "an autodiscoverable RSS feed without an RSS token" do
+ before do
+ visit group_path(group)
+ end
end
-
- it_behaves_like "an autodiscoverable RSS feed without an RSS token"
end
end