summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-06-19 11:25:21 -0500
committerDouwe Maan <douwe@selenight.nl>2017-06-19 11:50:46 -0500
commit5e8aca215243d2eaacb0a1b744909af2b7264a32 (patch)
treede0f75c16f746c62fbe19a74514f1f9fe7beb64c /spec
parentc0c394262833a4a35e3b2f7006ba6a4e93ef80d1 (diff)
downloadgitlab-ce-5e8aca215243d2eaacb0a1b744909af2b7264a32.tar.gz
Don't display comment on unchanged line on both sides in parallel diff
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/diff_helper_spec.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb
index 0ac030d3171..0d909e6e140 100644
--- a/spec/helpers/diff_helper_spec.rb
+++ b/spec/helpers/diff_helper_spec.rb
@@ -148,12 +148,21 @@ describe DiffHelper do
it 'puts comments on added lines' do
left = Gitlab::Diff::Line.new('\\nonewline', 'old-nonewline', 3, 3, 3)
- right = Gitlab::Diff::Line.new('new line', 'add', 3, 3, 3)
+ right = Gitlab::Diff::Line.new('new line', 'new', 3, 3, 3)
result = helper.parallel_diff_discussions(left, right, diff_file)
expect(result).to eq([nil, 'comment'])
end
+
+ it 'puts comments on unchanged lines' do
+ left = Gitlab::Diff::Line.new('unchanged line', nil, 3, 3, 3)
+ right = Gitlab::Diff::Line.new('unchanged line', nil, 3, 3, 3)
+
+ result = helper.parallel_diff_discussions(left, right, diff_file)
+
+ expect(result).to eq(['comment', nil])
+ end
end
describe "#diff_match_line" do