diff options
Diffstat (limited to 'spec/features/groups/issues_spec.rb')
-rw-r--r-- | spec/features/groups/issues_spec.rb | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index 21b39d2da46..489beb70ab3 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -33,7 +33,7 @@ RSpec.describe 'Group issues page' do # However,`:js` option forces Capybara to use Selenium that doesn't support`:has` context "it has an RSS button with current_user's feed token" do it "shows the RSS button with current_user's feed token" do - expect(find('[data-testid="rss-feed-link"]')['href']).to have_content(user.feed_token) + expect(page).to have_link 'Subscribe to RSS feed', href: /feed_token=#{user.feed_token}/ end end end @@ -46,7 +46,7 @@ RSpec.describe 'Group issues page' do # Note: please see the above context "it has an RSS button without a feed token" do it "shows the RSS button without a feed token" do - expect(find('[data-testid="rss-feed-link"]')['href']).not_to have_content('feed_token') + expect(page).not_to have_link 'Subscribe to RSS feed', href: /feed_token/ end end end @@ -94,6 +94,41 @@ RSpec.describe 'Group issues page' do expect(page).not_to have_content issue.title[0..80] end end + + context 'when cached issues state count is enabled', :clean_gitlab_redis_cache do + before do + stub_feature_flags(cached_issues_state_count: true) + end + + it 'truncates issue counts if over the threshold' do + allow(Rails.cache).to receive(:read).and_call_original + allow(Rails.cache).to receive(:read).with( + ['group', group.id, 'issues'], + { expires_in: Gitlab::IssuablesCountForState::CACHE_EXPIRES_IN } + ).and_return({ opened: 1050, closed: 500, all: 1550 }) + + visit issues_group_path(group) + + expect(page).to have_text('Open 1.1k Closed 500 All 1.6k') + end + end + + context 'when cached issues state count is disabled', :clean_gitlab_redis_cache do + before do + stub_feature_flags(cached_issues_state_count: false) + end + + it 'does not truncate counts if they are over the threshold' do + allow_next_instance_of(IssuesFinder) do |finder| + allow(finder).to receive(:count_by_state).and_return(true) + .and_return({ opened: 1050, closed: 500, all: 1550 }) + end + + visit issues_group_path(group) + + expect(page).to have_text('Open 1,050 Closed 500 All 1,550') + end + end end context 'projects with issues disabled' do |