mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-24 05:25:08 +01:00
1f5740e65c
* Use Rails tag API to build RSS feed for spoilers and polls While the previous method did not contain a bug or a potential issue, the tag API can be very resilient against future problems and reduces the amount of manual management of the escape status of the content. I've added tests to ensure that the formatting is broken and still escapes control characters correctly. * this seems cleaner and passes * Incorporate feedback by moving the br to its own line and using the tag helper over the string constant for the br tag itself * whoops, tag helper doesn't use a self-closing tag
25 lines
745 B
Ruby
25 lines
745 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe FormattingHelper, type: :helper do
|
|
include Devise::Test::ControllerHelpers
|
|
|
|
describe '#rss_status_content_format' do
|
|
let(:status) { Fabricate(:status, text: 'Hello world<>', spoiler_text: 'This is a spoiler<>', poll: Fabricate(:poll, options: %w(Yes<> No))) }
|
|
let(:html) { helper.rss_status_content_format(status) }
|
|
|
|
it 'renders the spoiler text' do
|
|
expect(html).to include('<p>This is a spoiler<></p><hr>')
|
|
end
|
|
|
|
it 'renders the status text' do
|
|
expect(html).to include('<p>Hello world<></p>')
|
|
end
|
|
|
|
it 'renders the poll' do
|
|
expect(html).to include('<radio disabled="disabled">Yes<></radio><br>')
|
|
end
|
|
end
|
|
end
|