diff options
author | Rémy Coutable <remy@rymai.me> | 2017-05-17 14:09:09 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-05-17 14:09:09 +0000 |
commit | d0db4080260a7ee8b276b825d1624fcc8dca54cb (patch) | |
tree | 65e2f113d8c7e52dfeba57f271d45e536a76c052 /spec/models | |
parent | 42814500438bd2d9aea75cfd372ec61da0d7468d (diff) | |
parent | a6c0eb54dc23931aaa6dd5630bee036c62f86ff5 (diff) | |
download | gitlab-ce-d0db4080260a7ee8b276b825d1624fcc8dca54cb.tar.gz |
Merge branch 'counters_cache_invalidation' into 'master'
Invalidate cache for issue and MR counters separately
See merge request !11394
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/user_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index f2c059010f4..e6e7774431e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1777,4 +1777,32 @@ describe User, models: true do expect(user.preferred_language).to eq('en') end end + + context '#invalidate_issue_cache_counts' do + let(:user) { build_stubbed(:user) } + + it 'invalidates cache for issue counter' do + cache_mock = double + + expect(cache_mock).to receive(:delete).with(['users', user.id, 'assigned_open_issues_count']) + + allow(Rails).to receive(:cache).and_return(cache_mock) + + user.invalidate_issue_cache_counts + end + end + + context '#invalidate_merge_request_cache_counts' do + let(:user) { build_stubbed(:user) } + + it 'invalidates cache for Merge Request counter' do + cache_mock = double + + expect(cache_mock).to receive(:delete).with(['users', user.id, 'assigned_open_merge_requests_count']) + + allow(Rails).to receive(:cache).and_return(cache_mock) + + user.invalidate_merge_request_cache_counts + end + end end |