diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 13:18:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 13:18:24 +0000 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/helpers/issuables_helper_spec.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) | |
download | gitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/helpers/issuables_helper_spec.rb')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index ecaee03eeea..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 @@ -285,7 +317,8 @@ RSpec.describe IssuablesHelper do initialDescriptionText: 'issue text', initialTaskStatus: '0 of 0 tasks completed', issueType: 'issue', - iid: issue.iid.to_s + iid: issue.iid.to_s, + isHidden: false } expect(helper.issuable_initial_data(issue)).to match(hash_including(expected_data)) end |