diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 12:38:00 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 12:38:00 +0300 |
commit | 25eea058335ed0149621fb7470c9e8db5a24b481 (patch) | |
tree | 6d811a8c91fa38fc80b3f1d996b6a5e1903328f0 /spec/helpers/icons_helper_spec.rb | |
parent | 20ac30a705f4edd22efd934ecf68b58557f868db (diff) |
Icon Sprite URL is also local even if asset_host is set
Diffstat (limited to 'spec/helpers/icons_helper_spec.rb')
-rw-r--r-- | spec/helpers/icons_helper_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/helpers/icons_helper_spec.rb b/spec/helpers/icons_helper_spec.rb index 3d79dac284f..0b5d96aaa2b 100644 --- a/spec/helpers/icons_helper_spec.rb +++ b/spec/helpers/icons_helper_spec.rb @@ -17,6 +17,27 @@ describe IconsHelper do end describe 'sprite_icon' do + it 'returns relative path' do + expect(sprite_icon_path()) + .to eq "/image/icons.svg" + end + + context 'when an asset_host is set in the config it will return an absolute local URL' do + let(:asset_host) { 'http://assets' } + + before do + allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) + end + + it 'returns an absolute URL on that asset host' do + gitlab_url = Gitlab.config.gitlab.url + expect(sprite_icon_path()) + .to eq "#{gitlab_url}/image/icons.svg" + end + end + end + + describe 'sprite_icon' do icon_name = 'clock' it 'returns svg icon html' do |