Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-10-11 14:41:02 +0300
committerRobert Speicher <robert@gitlab.com>2016-10-11 14:41:02 +0300
commit79eb7e4e921e681daf36a225b267c36084160a93 (patch)
treec19c50f444c43612062b78b9bece3d72707596f5 /spec
parent2ef90053d8dfc3e5e88f0cee6548117f5dae6f67 (diff)
parentd4fab17d7c8c2b233248295755a6277fdee09c9f (diff)
Merge branch 'sh-fix-issue-20776' into 'master'
Fix Error 500 when viewing old merge requests with bad diff data Customers running old versions of GitLab may have MergeRequestDiffs with the text ["--broken diff"] due to text generated by gitlab_git 1.0.3. To avoid the Error 500, verify that each element is a type that gitlab_git will accept before attempting to create a DiffCollection. Closes #20776 See merge request !6754
Diffstat (limited to 'spec')
-rw-r--r--spec/models/merge_request_diff_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/merge_request_diff_spec.rb b/spec/models/merge_request_diff_spec.rb
index 530a7def553..96f1f60dbc0 100644
--- a/spec/models/merge_request_diff_spec.rb
+++ b/spec/models/merge_request_diff_spec.rb
@@ -44,6 +44,16 @@ describe MergeRequestDiff, models: true do
end
end
+ context 'when the raw diffs have invalid content' do
+ before { mr_diff.update_attributes(st_diffs: ["--broken-diff"]) }
+
+ it 'returns an empty DiffCollection' do
+ expect(mr_diff.raw_diffs.to_a).to be_empty
+ expect(mr_diff.raw_diffs).to be_a(Gitlab::Git::DiffCollection)
+ expect(mr_diff.raw_diffs).to be_empty
+ end
+ end
+
context 'when the raw diffs exist' do
it 'returns the diffs' do
expect(mr_diff.raw_diffs).to be_a(Gitlab::Git::DiffCollection)