diff options
Diffstat (limited to 'spec/lib/gitlab/diff')
-rw-r--r-- | spec/lib/gitlab/diff/highlight_cache_spec.rb | 13 |
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 |