Commit f1e1e513 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Merge branch '23862-fix-group-project-count' into 'master'

Adding non_archived scope for counting projects

Closes #23862

See merge request !8305
parents 48079c31 9de5ec5c
......@@ -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')
......
---
title: Adding non_archived scope for counting projects
merge_request: 8305
author: Naveen Kumar
......@@ -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
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