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
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-05-17 17:09:09 +0300
committerTimothy Andrew <mail@timothyandrew.net>2017-06-12 10:59:12 +0300
commit04ba6ae564e406b3bfa244f5bdb4ab80151fbfd3 (patch)
tree7e24c53b49454965c7045fb265c2783411c3cf34 /spec
parent9fc3140e46b869225d103ac9714d9abc230c23a7 (diff)
Merge branch 'counters_cache_invalidation' into 'master'
Invalidate cache for issue and MR counters separately See merge request !11394
Diffstat (limited to 'spec')
-rw-r--r--spec/models/user_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 29ac82e004a..960546a7c91 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1764,4 +1764,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