diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 15:02:19 +0100 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 15:02:19 +0100 |
commit | 687e7dea5df7d0d53d48b49cc593b2bcb3c4ef93 (patch) | |
tree | 0aea592bf16675bb770626cdbf2b918da00b0338 | |
parent | 81eaf1719c763c00357b404ab5d690e4a00bd131 (diff) | |
download | gitlab-ce-687e7dea5df7d0d53d48b49cc593b2bcb3c4ef93.tar.gz |
Put Icons Path in Helper
-rw-r--r-- | spec/helpers/icons_helper_spec.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/helpers/icons_helper_spec.rb b/spec/helpers/icons_helper_spec.rb index 441668be028..c28f986f0e0 100644 --- a/spec/helpers/icons_helper_spec.rb +++ b/spec/helpers/icons_helper_spec.rb @@ -19,7 +19,7 @@ describe IconsHelper do describe 'sprite_icon_path' do it 'returns relative path' do expect(sprite_icon_path()) - .to eq image_path("icons.svg") + .to eq icons_path() end context 'when an asset_host is set in the config it will return an absolute local URL' do @@ -30,9 +30,8 @@ describe IconsHelper do end it 'returns an absolute URL on that asset host' do - gitlab_url = Gitlab.config.gitlab.url expect(sprite_icon_path()) - .to eq image_path("icons.svg", host: Gitlab.config.gitlab.url) + .to eq icons_path() end end end @@ -42,17 +41,17 @@ describe IconsHelper do it 'returns svg icon html' do expect(sprite_icon(icon_name).to_s) - .to eq "<svg><use xlink:href=\"#{image_path("icons.svg")}##{icon_name}\"></use></svg>" + .to eq "<svg><use xlink:href=\"#{icons_path()}##{icon_name}\"></use></svg>" end it 'returns svg icon html + size classes' do expect(sprite_icon(icon_name, size: 72).to_s) - .to eq "<svg class=\"s72\"><use xlink:href=\"#{image_path("icons.svg")}##{icon_name}\"></use></svg>" + .to eq "<svg class=\"s72\"><use xlink:href=\"#{icons_path()}##{icon_name}\"></use></svg>" end it 'returns svg icon html + size classes + additional class' do expect(sprite_icon(icon_name, size: 72, css_class: 'icon-danger').to_s) - .to eq "<svg class=\"s72 icon-danger\"><use xlink:href=\"#{image_path("icons.svg")}#{icon_name}\"></use></svg>" + .to eq "<svg class=\"s72 icon-danger\"><use xlink:href=\"#{icons_path()}#{icon_name}\"></use></svg>" end end @@ -161,4 +160,8 @@ describe IconsHelper do expect(file_type_icon_class('file', 0, 'CHANGELOG')).to eq 'file-text-o' end end + + def icons_path + ActionController::Base.helpers.image_path("icons.svg", host: Gitlab.config.gitlab.url) + end end |