summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorMicaël Bergeron <mbergeron@gitlab.com>2017-12-18 10:21:33 -0500
committerMicaël Bergeron <mbergeron@gitlab.com>2017-12-18 10:21:33 -0500
commitc77083a4938b42e1901a4cb69106a39a04f5c30d (patch)
tree514f1e9e5538a3124cd44dab02d973e722a24838 /spec/helpers
parentc90415085d4ecf7c71c8474a4ffdb27167ab2c19 (diff)
downloadgitlab-ce-c77083a4938b42e1901a4cb69106a39a04f5c30d.tar.gz
fix the commit diff discussion sending the wrong url
it should now send you to the merge request diff path scoped to the commit.
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/notes_helper_spec.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb
index cd15e27b497..36a44f8567a 100644
--- a/spec/helpers/notes_helper_spec.rb
+++ b/spec/helpers/notes_helper_spec.rb
@@ -41,6 +41,7 @@ describe NotesHelper do
describe '#discussion_path' do
let(:project) { create(:project, :repository) }
+ let(:anchor) { discussion.line_code }
context 'for a merge request discusion' do
let(:merge_request) { create(:merge_request, source_project: project, target_project: project, importing: true) }
@@ -151,6 +152,15 @@ describe NotesHelper do
expect(helper.discussion_path(discussion)).to be_nil
end
end
+
+ context 'for a contextual commit discussion' do
+ let(:commit) { merge_request.commits.last }
+ let(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project, commit_id: commit.id).to_discussion }
+
+ it 'returns the merge request diff discussion scoped in the commit' do
+ expect(helper.discussion_path(discussion)).to eq(diffs_project_merge_request_path(project, merge_request, commit_id: commit.id, anchor: anchor))
+ end
+ end
end
context 'for a commit discussion' do
@@ -160,7 +170,7 @@ describe NotesHelper do
let(:discussion) { create(:diff_note_on_commit, project: project).to_discussion }
it 'returns the commit path with the line code' do
- expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: discussion.line_code))
+ expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: anchor))
end
end
@@ -168,7 +178,7 @@ describe NotesHelper do
let(:discussion) { create(:legacy_diff_note_on_commit, project: project).to_discussion }
it 'returns the commit path with the line code' do
- expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: discussion.line_code))
+ expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: anchor))
end
end