summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/diff/suggestion_diff_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-14 00:09:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-14 00:09:07 +0000
commite144369009f3404072f7e0f969f7cded93195a01 (patch)
treed7a354e2c3c69a7ad65dc81aba8fe2ba59b0a26f /spec/lib/gitlab/diff/suggestion_diff_spec.rb
parentd466ee5042520ad078fe050cb078d81dc2ebe196 (diff)
downloadgitlab-ce-e144369009f3404072f7e0f969f7cded93195a01.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/diff/suggestion_diff_spec.rb')
-rw-r--r--spec/lib/gitlab/diff/suggestion_diff_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/suggestion_diff_spec.rb b/spec/lib/gitlab/diff/suggestion_diff_spec.rb
index 5a32c2bea37..0d4fe33bc47 100644
--- a/spec/lib/gitlab/diff/suggestion_diff_spec.rb
+++ b/spec/lib/gitlab/diff/suggestion_diff_spec.rb
@@ -51,5 +51,20 @@ describe Gitlab::Diff::SuggestionDiff do
expect(diff_lines[index].to_hash).to include(expected_line)
end
end
+
+ describe 'when the suggestion is for the last line of a file' do
+ it 'returns a correct value if there is no newline at the end of the file' do
+ from_content = "One line test"
+ to_content = "Successful test!"
+ suggestion = instance_double(Suggestion, from_line: 1,
+ from_content: from_content,
+ to_content: to_content)
+
+ diff_lines = described_class.new(suggestion).diff_lines
+
+ expect(diff_lines.first.text).to eq("-One line test")
+ expect(diff_lines.last.text).to eq("+Successful test!")
+ end
+ end
end
end