diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-07-01 12:11:15 +0300 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-07-01 12:57:41 +0300 |
commit | 3d701a7ccc8380ef230357363069d9fb0f5fe574 (patch) | |
tree | d6cd5d57a081da7df8b523a2d17baec81d04c912 /spec/lib/gitlab/diff | |
parent | 8775e4a1faf13a01451e71ea9ef729dc52e6d3c1 (diff) |
Don't show image diff note on text file
Diffstat (limited to 'spec/lib/gitlab/diff')
-rw-r--r-- | spec/lib/gitlab/diff/lines_unfolder_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/lines_unfolder_spec.rb b/spec/lib/gitlab/diff/lines_unfolder_spec.rb index 8a470e12d04..3134ff3d817 100644 --- a/spec/lib/gitlab/diff/lines_unfolder_spec.rb +++ b/spec/lib/gitlab/diff/lines_unfolder_spec.rb @@ -842,4 +842,37 @@ describe Gitlab::Diff::LinesUnfolder do end end end + + context 'positioned on an image' do + let(:position) do + Gitlab::Diff::Position.new( + base_sha: '1c59dfa64afbea8c721bb09a06a9d326c952ea19', + start_sha: '1c59dfa64afbea8c721bb09a06a9d326c952ea19', + head_sha: '1487062132228de836236c522fe52fed4980a46c', + old_path: 'image.jpg', + new_path: 'image.jpg', + position_type: 'image' + ) + end + + before do + allow(old_blob).to receive(:binary?).and_return(binary?) + end + + context 'diff file is not text' do + let(:binary?) { true } + + it 'returns nil' do + expect(subject.unfolded_diff_lines).to be_nil + end + end + + context 'diff file is text' do + let(:binary?) { false } + + it 'returns nil' do + expect(subject.unfolded_diff_lines).to be_nil + end + end + end end |