Commit 8b67fcc9 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ee-add-canary-favicon' into 'master'

Add canary favicon -- EE merge edition

See merge request gitlab-org/gitlab-ee!5135
parents 4149d7d8 f2d7b15c
......@@ -39,7 +39,10 @@ module PageLayoutHelper
end
def favicon
Rails.env.development? ? 'favicon-green.ico' : 'favicon.ico'
return 'favicon-yellow.ico' if Gitlab::Utils.to_boolean(ENV['CANARY'])
return 'favicon-green.ico' if Rails.env.development?
'favicon.ico'
end
def page_image
......
......@@ -7,8 +7,14 @@ class StatusEntity < Grape::Entity
expose :details_path
expose :favicon do |status|
dir = 'ci_favicons'
dir = File.join(dir, 'dev') if Rails.env.development?
dir =
if Gitlab::Utils.to_boolean(ENV['CANARY'])
File.join('ci_favicons', 'canary')
elsif Rails.env.development?
File.join('ci_favicons', 'dev')
else
'ci_favicons'
end
ActionController::Base.helpers.image_path(File.join(dir, "#{status.favicon}.ico"))
end
......
---
title: Add yellow favicon when `CANARY=true` to differientate canary environment
merge_request: 12477
author:
type: changed
......@@ -50,6 +50,11 @@ describe PageLayoutHelper do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
expect(helper.favicon).to eq 'favicon-green.ico'
end
it 'has yellow favicon for canary' do
stub_env('CANARY', 'true')
expect(helper.favicon).to eq 'favicon-yellow.ico'
end
end
describe 'page_image' do
......
......@@ -25,5 +25,10 @@ describe StatusEntity do
allow(Rails.env).to receive(:development?) { true }
expect(entity.as_json[:favicon]).to match_asset_path('/assets/ci_favicons/dev/favicon_status_success.ico')
end
it 'contains a canary namespaced favicon if canary env' do
stub_env('CANARY', 'true')
expect(entity.as_json[:favicon]).to match_asset_path('/assets/ci_favicons/canary/favicon_status_success.ico')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment