From 5b092d21cca71dde8f032dfcb9b7b41612a8727f Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Thu, 22 Jun 2017 01:51:46 +0200 Subject: Encode Gitaly diff patches properly --- spec/lib/gitlab/git/diff_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec') diff --git a/spec/lib/gitlab/git/diff_spec.rb b/spec/lib/gitlab/git/diff_spec.rb index 5627562abfb..d50ccb0df30 100644 --- a/spec/lib/gitlab/git/diff_spec.rb +++ b/spec/lib/gitlab/git/diff_spec.rb @@ -175,6 +175,14 @@ EOT expect(diff).to be_too_large end end + + context 'when the patch passed is not UTF-8-encoded' do + let(:raw_patch) { @raw_diff_hash[:diff].encode(Encoding::ASCII_8BIT) } + + it 'encodes diff patch to UTF-8' do + expect(diff.diff.encoding).to eq(Encoding::UTF_8) + end + end end end -- cgit v1.2.3