gitlab-org--gitlab-foss/spec/lib/gitlab/favicon_spec.rb

39 lines
1.4 KiB
Ruby
Raw Normal View History

2017-09-26 15:04:37 +00:00
require 'rails_helper'
2017-09-28 08:45:50 +00:00
RSpec.describe Gitlab::Favicon, :request_store do
describe '.main' do
2017-09-26 15:04:37 +00:00
it 'defaults to favicon.ico' do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production'))
expect(described_class.main).to eq 'favicon.ico'
2017-09-26 15:04:37 +00:00
end
it 'has blue favicon for development' do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
expect(described_class.main).to eq 'favicon-blue.ico'
2017-09-26 15:04:37 +00:00
end
it 'has yellow favicon for canary' do
stub_env('CANARY', 'true')
expect(described_class.main).to eq 'favicon-yellow.ico'
2017-09-26 15:04:37 +00:00
end
it 'uses the custom favicon if a favicon appearance is present' do
create :appearance, favicon: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'))
expect(described_class.main).to match %r{/uploads/-/system/appearance/favicon/\d+/favicon_main_dk.ico}
2017-09-26 15:04:37 +00:00
end
end
describe '.status' do
subject { described_class.status('favicon_status_created') }
it 'defaults to the stock icon' do
expect(subject).to eq '/assets/ci_favicons/favicon_status_created.ico'
end
it 'uses the custom favicon if a favicon appearance is present' do
create :appearance, favicon: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'))
expect(subject).to match(%r{/uploads/-/system/appearance/favicon/\d+/favicon_status_created_dk.ico})
end
end
2017-09-26 15:04:37 +00:00
end