diff options
Diffstat (limited to 'spec/lib/gitlab/diff/highlight_cache_spec.rb')
-rw-r--r-- | spec/lib/gitlab/diff/highlight_cache_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/highlight_cache_spec.rb b/spec/lib/gitlab/diff/highlight_cache_spec.rb index 9e94a63ea4b..e643b58ee32 100644 --- a/spec/lib/gitlab/diff/highlight_cache_spec.rb +++ b/spec/lib/gitlab/diff/highlight_cache_spec.rb @@ -185,6 +185,15 @@ RSpec.describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do expect { cache.send(:write_to_redis_hash, diff_hash) } .to change { Gitlab::Redis::Cache.with { |r| r.hgetall(cache_key) } } end + + context 'when diff contains unsupported characters' do + let(:diff_hash) { { 'README' => [{ line_code: nil, rich_text: nil, text: [0xff, 0xfe, 0x0, 0x23].pack("c*"), type: "match", index: 0, old_pos: 17, new_pos: 17 }] } } + + it 'does not update the cache' do + expect { cache.send(:write_to_redis_hash, diff_hash) } + .not_to change { Gitlab::Redis::Cache.with { |r| r.hgetall(cache_key) } } + end + end end describe '#clear' do |