diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2018-06-20 14:00:13 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-06-20 14:00:13 +0000 |
commit | b612670cc0a9eabce5d0f8aa86e93823a4639c04 (patch) | |
tree | 1b3f4f8c163ed68dcb37814cea052be7a955d6bb /spec | |
parent | b349c01c6a71ac1f486b8ee86ce96ef48ac04ed8 (diff) | |
download | gitlab-ce-b612670cc0a9eabce5d0f8aa86e93823a4639c04.tar.gz |
Fix: Serve favicon image always from the main GitLab domain to avoid issues with CORS
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/favicon_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/favicon_spec.rb b/spec/lib/gitlab/favicon_spec.rb index f36111a4946..122dcd9634c 100644 --- a/spec/lib/gitlab/favicon_spec.rb +++ b/spec/lib/gitlab/favicon_spec.rb @@ -21,6 +21,21 @@ RSpec.describe Gitlab::Favicon, :request_store do create :appearance, favicon: fixture_file_upload('spec/fixtures/dk.png') expect(described_class.main).to match %r{/uploads/-/system/appearance/favicon/\d+/dk.png} end + + context 'asset host' do + before do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production')) + end + + it 'returns a relative url when the asset host is not configured' do + expect(described_class.main).to match %r{^/assets/favicon-(?:\h+).png$} + end + + it 'returns a full url when the asset host is configured' do + allow(Gitlab::Application.config).to receive(:asset_host).and_return('http://assets.local') + expect(described_class.main).to match %r{^http://localhost/assets/favicon-(?:\h+).png$} + end + end end describe '.status_overlay' do |