Helpers specs coverage improvement (#23937)
This commit is contained in:
parent
00eb2269b6
commit
2f606ba122
5 changed files with 216 additions and 10 deletions
|
@ -3,6 +3,68 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StatusesHelper, type: :helper do
|
||||
describe 'link_to_newer' do
|
||||
it 'returns a link to newer content' do
|
||||
url = 'https://example.com'
|
||||
result = helper.link_to_newer(url)
|
||||
|
||||
expect(result).to match('load-more')
|
||||
expect(result).to match(I18n.t('statuses.show_newer'))
|
||||
end
|
||||
end
|
||||
|
||||
describe 'link_to_older' do
|
||||
it 'returns a link to older content' do
|
||||
url = 'https://example.com'
|
||||
result = helper.link_to_older(url)
|
||||
|
||||
expect(result).to match('load-more')
|
||||
expect(result).to match(I18n.t('statuses.show_older'))
|
||||
end
|
||||
end
|
||||
|
||||
describe 'fa_visibility_icon' do
|
||||
context 'with a status that is public' do
|
||||
let(:status) { Status.new(visibility: 'public') }
|
||||
|
||||
it 'returns the correct fa icon' do
|
||||
result = helper.fa_visibility_icon(status)
|
||||
|
||||
expect(result).to match('fa-globe')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a status that is unlisted' do
|
||||
let(:status) { Status.new(visibility: 'unlisted') }
|
||||
|
||||
it 'returns the correct fa icon' do
|
||||
result = helper.fa_visibility_icon(status)
|
||||
|
||||
expect(result).to match('fa-unlock')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a status that is private' do
|
||||
let(:status) { Status.new(visibility: 'private') }
|
||||
|
||||
it 'returns the correct fa icon' do
|
||||
result = helper.fa_visibility_icon(status)
|
||||
|
||||
expect(result).to match('fa-lock')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a status that is direct' do
|
||||
let(:status) { Status.new(visibility: 'direct') }
|
||||
|
||||
it 'returns the correct fa icon' do
|
||||
result = helper.fa_visibility_icon(status)
|
||||
|
||||
expect(result).to match('fa-at')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#stream_link_target' do
|
||||
it 'returns nil if it is not an embedded view' do
|
||||
set_not_embedded_view
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue