Commit 6e698b25 authored by Douwe Maan's avatar Douwe Maan

Fix specs

parent 14a0841a
......@@ -121,7 +121,7 @@ class Note < ActiveRecord::Base
end
def grouped_diff_discussions(diff_refs = nil)
groups = Hash.new { |h, k| h[k] = [] }
groups = {}
diff_notes.fresh.discussions.each do |discussion|
line_code =
......@@ -131,7 +131,10 @@ class Note < ActiveRecord::Base
discussion.original_line_code
end
groups[line_code] << discussion if line_code
if line_code
discussions = groups[line_code] ||= []
discussions << discussion
end
end
groups
......
......@@ -168,7 +168,6 @@ module Gitlab
bd_diff = bd_diffs.diff_file_with_old_path(b_path)
d_path = bd_diff&.new_path || b_path
d_line = LineMapper.new(bd_diff).old_to_new(b_line)
cd_diff = cd_diffs.diff_file_with_old_path(c_path)
......
......@@ -43,7 +43,7 @@ feature 'Merge Request Discussions', feature: true do
it 'shows a link to the outdated diff' do
within(".discussion[data-discussion-id='#{outdated_discussion.id}']") do
path = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, diff_id: old_merge_request_diff.id, anchor: outdated_discussion.line_code)
expect(page).to have_link('an outdated diff', href: path)
expect(page).to have_link('an old version of the diff', href: path)
end
end
end
......
......@@ -92,7 +92,13 @@ describe NotesHelper do
)
end
let(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project, position: position).to_discussion }
let(:diff_note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project, position: position) }
let(:discussion) { diff_note.to_discussion }
before do
diff_note.position = diff_note.original_position
diff_note.save!
end
it 'returns the diff version comparison path with the line code' do
expect(helper.discussion_path(discussion)).to eq(diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, diff_id: merge_request_diff3, start_sha: merge_request_diff1.head_commit_sha, anchor: discussion.line_code))
......
......@@ -54,6 +54,7 @@ Note:
- type
- position
- original_position
- change_position
- resolved_at
- resolved_by_id
- discussion_id
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment