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
diff options
context:
space:
mode:
authorMatthew Dodds <matthewrusselldodds@gmail.com>2016-09-30 04:51:33 +0300
committerMatthew Dodds <matthewrusselldodds@gmail.com>2016-09-30 04:51:33 +0300
commitec82cecf3c54cb2cd1ab7b72f77e787be1bf1264 (patch)
tree93dfe504596787d20faea4888b6e933128ccd917 /spec/services/system_note_service_spec.rb
parentce0591df704028c467dbb34c1521347c3b8c7cda (diff)
Add link to comparison from system note, update changelog
Diffstat (limited to 'spec/services/system_note_service_spec.rb')
-rw-r--r--spec/services/system_note_service_spec.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 3d854a959f3..16e345501d9 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -40,21 +40,35 @@ describe SystemNoteService, services: true do
describe 'note body' do
let(:note_lines) { subject.note.split("\n").reject(&:blank?) }
+ describe 'comparison diff link line' do
+ it 'adds the comparison link' do
+ link = Gitlab::Routing.url_helpers.diffs_namespace_project_merge_request_url(
+ project.namespace,
+ project,
+ noteable.iid,
+ diff_id: noteable.merge_request_diff.id,
+ start_sha: oldrev
+ )
+
+ expect(note_lines[0]).to eq "[Compare with previous version](#{link})"
+ end
+ end
+
context 'without existing commits' do
it 'adds a message header' do
- expect(note_lines[0]).to eq "Added #{new_commits.size} commits:"
+ expect(note_lines[1]).to eq "Added #{new_commits.size} commits:"
end
it 'adds a message line for each commit' do
new_commits.each_with_index do |commit, i|
# Skip the header
- expect(note_lines[i + 1]).to eq "* #{commit.short_id} - #{commit.title}"
+ expect(note_lines[i + 2]).to eq "* #{commit.short_id} - #{commit.title}"
end
end
end
describe 'summary line for existing commits' do
- let(:summary_line) { note_lines[1] }
+ let(:summary_line) { note_lines[2] }
context 'with one existing commit' do
let(:old_commits) { [noteable.commits.last] }