summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/diff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 18:08:04 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 18:08:04 +0000
commit115c8ea7af7ef69ca3f09c333314546e9b5712f9 (patch)
treec3b6798c11e502f7d2785649f95d2255beac3c91 /spec/lib/gitlab/diff
parent27d91a629918e417a9e87825e838209b9ace79c1 (diff)
downloadgitlab-ce-115c8ea7af7ef69ca3f09c333314546e9b5712f9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/diff')
-rw-r--r--spec/lib/gitlab/diff/highlight_cache_spec.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/lib/gitlab/diff/highlight_cache_spec.rb b/spec/lib/gitlab/diff/highlight_cache_spec.rb
index 163a140b6c2..6dabfd0ef2c 100644
--- a/spec/lib/gitlab/diff/highlight_cache_spec.rb
+++ b/spec/lib/gitlab/diff/highlight_cache_spec.rb
@@ -72,13 +72,22 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
describe '#write_if_empty' do
it 'filters the key/value list of entries to be caches for each invocation' do
+ paths = merge_request.diffs.diff_files.select(&:text?).map(&:file_path)
+
expect(cache).to receive(:write_to_redis_hash)
- .once.with(hash_including(".gitignore")).and_call_original
- expect(cache).to receive(:write_to_redis_hash).once.with({}).and_call_original
+ .with(hash_including(*paths))
+ .once
+ .and_call_original
2.times { cache.write_if_empty }
end
+ it 'reads from cache once' do
+ expect(cache).to receive(:read_cache).once.and_call_original
+
+ cache.write_if_empty
+ end
+
context 'different diff_collections for the same diffable' do
before do
cache.write_if_empty