diff options
author | Nick Thomas <nick@gitlab.com> | 2018-12-05 16:40:24 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-12-05 16:40:24 +0300 |
commit | 61bc233ef0df1395ad82ec8d48ee4dfd8c67e0be (patch) | |
tree | b01607cdff4a3d15d010a67b5ea375e1078a55bc /spec/support/shared_examples | |
parent | da2da0fa599f0a27d0f00e4b2077f7940cf935df (diff) | |
parent | 89a676019cd580520e6c2ee696b15818d6ca954a (diff) |
Merge branch 'osw-fix-grouping-by-file-path' into 'master'
Avoid 500's when serializing legacy diff notes
Closes #54793
See merge request gitlab-org/gitlab-ce!23544
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/diff_file_collections.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/shared_examples/diff_file_collections.rb b/spec/support/shared_examples/diff_file_collections.rb index 55ce160add0..367ddf06c28 100644 --- a/spec/support/shared_examples/diff_file_collections.rb +++ b/spec/support/shared_examples/diff_file_collections.rb @@ -45,3 +45,19 @@ shared_examples 'diff statistics' do |test_include_stats_flag: true| end end end + +shared_examples 'unfoldable diff' do + let(:subject) { described_class.new(diffable, diff_options: nil) } + + it 'calls Gitlab::Diff::File#unfold_diff_lines with correct position' do + position = instance_double(Gitlab::Diff::Position, file_path: 'README') + readme_file = instance_double(Gitlab::Diff::File, file_path: 'README') + other_file = instance_double(Gitlab::Diff::File, file_path: 'foo.rb') + nil_path_file = instance_double(Gitlab::Diff::File, file_path: nil) + + allow(subject).to receive(:diff_files) { [readme_file, other_file, nil_path_file] } + expect(readme_file).to receive(:unfold_diff_lines).with(position) + + subject.unfold_diff_files([position]) + end +end |