This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

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

Fix specs

parent b7d96a1bce11
......@@ -121,7 +121,7 @@ def find_discussion(discussion_id)
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 @@ def grouped_diff_discussions(diff_refs = nil)
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 @@ def trace_unchanged_line(ab_position)
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 @@
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 @@
)
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