diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-03-24 23:00:46 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-03-24 23:00:46 +0300 |
commit | f1e1e51311b6f50c98b3e1476942107269c28a97 (patch) | |
tree | 86b722069506e4d21e2dceeaf2a02cad7fa628aa | |
parent | 48079c3169688e4cfbaf89946d9ef61b335731e0 (diff) | |
parent | 9de5ec5c3e8405da87b782953e3833e8588d82a4 (diff) |
Merge branch '23862-fix-group-project-count' into 'master'
Adding non_archived scope for counting projects
Closes #23862
See merge request !8305
-rw-r--r-- | app/views/shared/groups/_group.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/23862-fix-group-project-count.yml | 4 | ||||
-rw-r--r-- | spec/features/explore/groups_list_spec.rb | 20 |
3 files changed, 25 insertions, 1 deletions
diff --git a/app/views/shared/groups/_group.html.haml b/app/views/shared/groups/_group.html.haml index a95020a9be8..09f946f1d88 100644 --- a/app/views/shared/groups/_group.html.haml +++ b/app/views/shared/groups/_group.html.haml @@ -17,7 +17,7 @@ .stats %span = icon('bookmark') - = number_with_delimiter(group.projects.count) + = number_with_delimiter(group.projects.non_archived.count) %span = icon('users') diff --git a/changelogs/unreleased/23862-fix-group-project-count.yml b/changelogs/unreleased/23862-fix-group-project-count.yml new file mode 100644 index 00000000000..7b2e9f9bfa6 --- /dev/null +++ b/changelogs/unreleased/23862-fix-group-project-count.yml @@ -0,0 +1,4 @@ +--- +title: Adding non_archived scope for counting projects +merge_request: 8305 +author: Naveen Kumar diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 773ae4b38bc..9daaaa8e555 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -7,6 +7,7 @@ describe 'Explore Groups page', js: true, feature: true do let!(:group) { create(:group) } let!(:public_group) { create(:group, :public) } let!(:private_group) { create(:group, :private) } + let!(:empty_project) { create(:empty_project, group: public_group) } before do group.add_owner(user) @@ -43,4 +44,23 @@ describe 'Explore Groups page', js: true, feature: true do expect(page).not_to have_content(private_group.full_name) expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 end + + it 'shows non-archived projects count' do + # Initially project is not archived + expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1") + + # Archive project + empty_project.archive! + visit explore_groups_path + + # Check project count + expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("0") + + # Unarchive project + empty_project.unarchive! + visit explore_groups_path + + # Check project count + expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1") + end end |