Skip to content

Commit

Permalink
update record helper to include correct class for mods gem, update re…
Browse files Browse the repository at this point in the history
…lated tests
  • Loading branch information
dnoneill committed Jan 19, 2024
1 parent de93eba commit 3945c48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/helpers/record_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def linked_mods_genres(genres)
##
# Expose format_mods_html from mods_display to properly encode content as needed
# RecordHelper behavior
def format_record_html(...)
format_mods_html(...)
def format_record_html(record_content)
format_mods_html(record_content, field: ModsDisplay::Values.new(field: ModsDisplay::Contents.new(nil)))
end
end
4 changes: 2 additions & 2 deletions spec/helpers/record_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
let(:html) { "some text\r\nsome other text" }

it 'returns the string without changing the encoding' do
expect(helper.format_record_html(html)).to eq "some text\nsome other text"
expect(helper.format_record_html(html)).to eq "<p>some text\n<br />some other text</p>"
end
end

context 'when the record has encoded line feeds in the string' do
let(:html) { "some text&#13\nsome other text" }

it 'returns the string with proper encoding' do
expect(helper.format_record_html(html)).to eq "some text\nsome other text"
expect(helper.format_record_html(html)).to eq "<p>some text\n<br />some other text</p>"
end
end
end
Expand Down

0 comments on commit 3945c48

Please sign in to comment.