Coverage improvement round-out following up previous work (#23987)
This commit is contained in:
parent
56bddfbfa3
commit
688287c59d
17 changed files with 336 additions and 1 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue