diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 15:07:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-04 15:07:12 +0300 |
commit | 98420be3dddf5a093c39d96a8ca109aa21d0eaf8 (patch) | |
tree | 694cbe805e82d5383dc30c462f5efb60e55ccebe /spec/services/merge_requests | |
parent | c4038d4bdff93b260cbdcd69f9a6c0b07a849457 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/merge_requests')
-rw-r--r-- | spec/services/merge_requests/reload_diffs_service_spec.rb | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/spec/services/merge_requests/reload_diffs_service_spec.rb b/spec/services/merge_requests/reload_diffs_service_spec.rb index cc21348ab11..c450fc0a7dc 100644 --- a/spec/services/merge_requests/reload_diffs_service_spec.rb +++ b/spec/services/merge_requests/reload_diffs_service_spec.rb @@ -33,13 +33,34 @@ describe MergeRequests::ReloadDiffsService, :use_clean_rails_memory_store_cachin end context 'cache clearing' do - it 'clears the cache for older diffs on the merge request' do - old_diff = merge_request.merge_request_diff - old_cache_key = old_diff.diffs_collection.cache_key + context 'using Gitlab::Diff::DeprecatedHighlightCache' do + before do + stub_feature_flags(hset_redis_diff_caching: false) + end - expect(Rails.cache).to receive(:delete).with(old_cache_key).and_call_original + it 'clears the cache for older diffs on the merge request' do + old_diff = merge_request.merge_request_diff + old_cache_key = old_diff.diffs_collection.cache_key - subject.execute + expect(Rails.cache).to receive(:delete).with(old_cache_key).and_call_original + + subject.execute + end + end + + context 'using Gitlab::Diff::HighlightCache' do + before do + stub_feature_flags(hset_redis_diff_caching: true) + end + + it 'clears the cache for older diffs on the merge request' do + old_diff = merge_request.merge_request_diff + old_cache_key = old_diff.diffs_collection.cache_key + + expect_any_instance_of(Redis).to receive(:del).with(old_cache_key).and_call_original + + subject.execute + end end it 'avoids N+1 queries', :request_store do |