diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-07-22 13:25:24 +0800 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-07-22 13:25:24 +0800 |
commit | 866bef8059591db9a17db71d66a1321b0ca25153 (patch) | |
tree | 84dcaf3f611c769c5676220040d163374fbcd3f0 /spec/presenters/blobs/unfold_presenter_spec.rb | |
parent | bf172b115c206cb6ed6c2b271fad600f1548b43c (diff) | |
download | gitlab-ce-866bef8059591db9a17db71d66a1321b0ca25153.tar.gz |
Fix suggestion on lines that are not part of an MR57953-fix-unfolded-diff-suggestions
Return the `text` as plain string in the response instead of
including HTML tags but keep `rich_text` as is.
The fix is to modify `Blob::UnfoldPresenter#diff_files` to map
each raw diff line (limited by the range specified) to a
corresponding line in an array of highlighted lines to use as
`rich_text`.
Diffstat (limited to 'spec/presenters/blobs/unfold_presenter_spec.rb')
-rw-r--r-- | spec/presenters/blobs/unfold_presenter_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/presenters/blobs/unfold_presenter_spec.rb b/spec/presenters/blobs/unfold_presenter_spec.rb index 7ece5f623ce..1534c572b30 100644 --- a/spec/presenters/blobs/unfold_presenter_spec.rb +++ b/spec/presenters/blobs/unfold_presenter_spec.rb @@ -54,8 +54,10 @@ describe Blobs::UnfoldPresenter do expect(lines.size).to eq(total_lines) lines.each.with_index do |line, index| - expect(line.text).to include("LC#{index + 1}") - expect(line.text).to eq(line.rich_text) + line_number = index + 1 + + expect(line.text).to eq(line_number.to_s) + expect(line.rich_text).to include("LC#{line_number}") expect(line.type).to be_nil end end |