diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-26 18:06:36 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-26 18:06:36 +0300 |
commit | 91ab86e59c29f03ab91f58112d5cf7eda608905b (patch) | |
tree | ac8dc4c6742cccc9b22a93440f52d40471787e6c /spec | |
parent | 2e59b4ea15f819d3b41140bf15a8e95a4a760cd3 (diff) | |
parent | e351f67874fb98d1d40bd32dca8d9a44a4fc8582 (diff) |
Merge branch 'suppress-squash-warnings' into 'master'
Suppress whitespace warnings in squash error messages
Closes gitlab-ee#3639
See merge request gitlab-org/gitlab-ce!17317
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index d601a383a98..13358995383 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -2283,6 +2283,20 @@ describe Gitlab::Git::Repository, seed_helper: true do expect(subject).to match(/\h{40}/) end end + + context 'with trailing whitespace in an invalid patch', :skip_gitaly_mock do + let(:diff) { "diff --git a/README.md b/README.md\nindex faaf198..43c5edf 100644\n--- a/README.md\n+++ b/README.md\n@@ -1,4 +1,4 @@\n-testme\n+ \n ====== \n \n Sample repo for testing gitlab features\n" } + + it 'does not include whitespace warnings in the error' do + allow(repository).to receive(:run_git!).and_call_original + allow(repository).to receive(:run_git!).with(%W(diff --binary #{start_sha}...#{end_sha})).and_return(diff.force_encoding('ASCII-8BIT')) + + expect { subject }.to raise_error do |error| + expect(error).to be_a(described_class::GitError) + expect(error.message).not_to include('trailing whitespace') + end + end + end end end |