Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-01 18:10:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-01 18:10:20 +0300
commit9c191c0b942eb08360f4d64c038c435b1156e15f (patch)
tree18ac3c7c2d816ffa4898202102cb889c2c6ca5a7 /spec/helpers
parent219501933150525be819f047d3196969ee914c47 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/issuables_helper_spec.rb34
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb
index 679871b6672..3eb3c73cfcc 100644
--- a/spec/helpers/issuables_helper_spec.rb
+++ b/spec/helpers/issuables_helper_spec.rb
@@ -123,7 +123,7 @@ RSpec.describe IssuablesHelper do
end
describe '#issuables_state_counter_text' do
- let(:user) { create(:user) }
+ let_it_be(:user) { create(:user) }
describe 'state text' do
context 'when number of issuables can be generated' do
@@ -159,6 +159,38 @@ RSpec.describe IssuablesHelper do
.to eq('<span>All</span>')
end
end
+
+ context 'when count is over the threshold' do
+ let_it_be(:group) { create(:group) }
+
+ before do
+ allow(helper).to receive(:issuables_count_for_state).and_return(1100)
+ allow(helper).to receive(:parent).and_return(group)
+ stub_const("Gitlab::IssuablesCountForState::THRESHOLD", 1000)
+ end
+
+ context 'when feature flag cached_issues_state_count is disabled' do
+ before do
+ stub_feature_flags(cached_issues_state_count: false)
+ end
+
+ it 'returns complete count' do
+ expect(helper.issuables_state_counter_text(:issues, :opened, true))
+ .to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">1,100</span>')
+ end
+ end
+
+ context 'when feature flag cached_issues_state_count is enabled' do
+ before do
+ stub_feature_flags(cached_issues_state_count: true)
+ end
+
+ it 'returns truncated count' do
+ expect(helper.issuables_state_counter_text(:issues, :opened, true))
+ .to eq('<span>Open</span> <span class="badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm">1.1k</span>')
+ end
+ end
+ end
end
end