0
0
Fork 0

Coverage improvement round-out following up previous work (#23987)

This commit is contained in:
Matt Jankowski 2023-03-10 07:33:30 -05:00 committed by GitHub
parent 56bddfbfa3
commit 688287c59d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 336 additions and 1 deletions

View file

@ -2,7 +2,33 @@
require 'rails_helper'
RSpec.describe StatusesHelper, type: :helper do
describe StatusesHelper do
describe 'status_text_summary' do
context 'with blank text' do
let(:status) { Status.new(spoiler_text: '') }
it 'returns immediately with nil' do
result = helper.status_text_summary(status)
expect(result).to be_nil
end
end
context 'with present text' do
let(:status) { Status.new(spoiler_text: 'SPOILERS!!!') }
it 'returns the content warning' do
result = helper.status_text_summary(status)
expect(result).to eq(I18n.t('statuses.content_warning', warning: 'SPOILERS!!!'))
end
end
end
def status_text_summary(status)
return if status.spoiler_text.blank?
I18n.t('statuses.content_warning', warning: status.spoiler_text)
end
describe 'link_to_newer' do
it 'returns a link to newer content' do
url = 'https://example.com'