diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/lib/gitlab/git/diff_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/git/diff_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git/diff_spec.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/spec/lib/gitlab/git/diff_spec.rb b/spec/lib/gitlab/git/diff_spec.rb index 46f544797bb..2c931a999f1 100644 --- a/spec/lib/gitlab/git/diff_spec.rb +++ b/spec/lib/gitlab/git/diff_spec.rb @@ -165,17 +165,21 @@ EOT context 'when diff contains invalid characters' do let(:bad_string) { [0xae].pack("C*") } let(:bad_string_two) { [0x89].pack("C*") } + let(:bad_string_three) { "@@ -1,5 +1,6 @@\n \xFF\xFE#\x00l\x00a\x00n\x00g\x00u\x00" } let(:diff) { described_class.new(@raw_diff_hash.merge({ diff: bad_string })) } let(:diff_two) { described_class.new(@raw_diff_hash.merge({ diff: bad_string_two })) } + let(:diff_three) { described_class.new(@raw_diff_hash.merge({ diff: bad_string_three })) } context 'when replace_invalid_utf8_chars is true' do it 'will convert invalid characters and not cause an encoding error' do expect(diff.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER) expect(diff_two.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER) + expect(diff_three.diff).to include(Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER) - expect { Oj.dump(diff) }.not_to raise_error(EncodingError) - expect { Oj.dump(diff_two) }.not_to raise_error(EncodingError) + expect { Oj.dump(diff) }.not_to raise_error + expect { Oj.dump(diff_two) }.not_to raise_error + expect { Oj.dump(diff_three) }.not_to raise_error end context 'when the diff is binary' do |