diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-06-11 07:25:01 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-06-11 07:25:01 +0000 |
commit | 641d332351907b77b53b0cb23ff51ccea2489824 (patch) | |
tree | e53598605beef0ece77fbb4403324ad336d24ac5 /spec | |
parent | c9216d630554132a8403cf251d122f93e44f2772 (diff) | |
parent | df650eaae5f94357f155c9b35c51a6b8c98fb6d7 (diff) | |
download | gitlab-ce-641d332351907b77b53b0cb23ff51ccea2489824.tar.gz |
Merge branch 'sh-fix-utf-8-encoding-resolve-conflicts' into 'master'
Fix UTF-8 conversion issues when resolving conflicts
Closes #63062
See merge request gitlab-org/gitlab-ce!29453
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb b/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb index e4fe01a671f..52630ba0223 100644 --- a/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb @@ -35,7 +35,7 @@ describe Gitlab::GitalyClient::ConflictsService do end let(:source_branch) { 'master' } let(:target_branch) { 'feature' } - let(:commit_message) { 'Solving conflicts' } + let(:commit_message) { 'Solving conflicts\n\nTést' } let(:resolution) do Gitlab::Git::Conflict::Resolution.new(user, files, commit_message) end @@ -51,6 +51,25 @@ describe Gitlab::GitalyClient::ConflictsService do subject end + context 'with branches with UTF-8 characters' do + let(:source_branch) { 'testòbranch' } + let(:target_branch) { 'ábranch' } + + it 'handles commit messages with UTF-8 characters' do + allow(::Gitlab::GitalyClient).to receive(:call).and_call_original + expect(::Gitlab::GitalyClient).to receive(:call).with(anything, :conflicts_service, :resolve_conflicts, any_args) do |*args| + # Force the generation of request messages by iterating through the enumerator + message = args[3].to_a.first + params = [message.header.commit_message, message.header.source_branch, message.header.target_branch] + expect(params.map(&:encoding).uniq).to eq([Encoding::ASCII_8BIT]) + + double(resolution_error: nil) + end + + subject + end + end + it 'raises a relevant exception if resolution_error is present' do expect_any_instance_of(Gitaly::ConflictsService::Stub).to receive(:resolve_conflicts) .with(kind_of(Enumerator), kind_of(Hash)).and_return(double(resolution_error: "something happened")) |