|
|
|
|
@ -286,26 +286,31 @@ describe ApplicationHelper do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe '#site_icon_path' do
|
|
|
|
|
describe 'favicon' do
|
|
|
|
|
context 'when an icon exists' do
|
|
|
|
|
let!(:favicon) { Fabricate(:site_upload, var: 'favicon') }
|
|
|
|
|
let!(:app_icon) { Fabricate(:site_upload, var: 'app_icon') }
|
|
|
|
|
|
|
|
|
|
it 'returns the URL of the icon' do
|
|
|
|
|
expect(helper.site_icon_path('favicon')).to eq(favicon.file.url('48'))
|
|
|
|
|
expect(helper.favicon_path).to eq(favicon.file.url('48'))
|
|
|
|
|
expect(helper.app_icon_path).to eq(app_icon.file.url('48'))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'returns the URL of the icon with size parameter' do
|
|
|
|
|
expect(helper.site_icon_path('favicon', 16)).to eq(favicon.file.url('16'))
|
|
|
|
|
expect(helper.favicon_path(16)).to eq(favicon.file.url('16'))
|
|
|
|
|
expect(helper.app_icon_path(16)).to eq(app_icon.file.url('16'))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when an icon does not exist' do
|
|
|
|
|
it 'returns nil' do
|
|
|
|
|
expect(helper.site_icon_path('favicon')).to be_nil
|
|
|
|
|
expect(helper.favicon_path).to be_nil
|
|
|
|
|
expect(helper.app_icon_path).to be_nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'returns nil with size parameter' do
|
|
|
|
|
expect(helper.site_icon_path('favicon', 16)).to be_nil
|
|
|
|
|
expect(helper.favicon_path(16)).to be_nil
|
|
|
|
|
expect(helper.app_icon_path(16)).to be_nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|