diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 17:35:12 +0100 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-11-09 17:35:12 +0100 |
commit | 01240a1836677b4a737ea1de816ae23be0c2c4b2 (patch) | |
tree | 4ba6ed347e71b4114ba523b0b82d980813b3c851 /spec/helpers/icons_helper_spec.rb | |
parent | fb1b88de1b64789f40b3775360d668821d6a5953 (diff) | |
download | gitlab-ce-01240a1836677b4a737ea1de816ae23be0c2c4b2.tar.gz |
Fixed Function + Test based on MR
Diffstat (limited to 'spec/helpers/icons_helper_spec.rb')
-rw-r--r-- | spec/helpers/icons_helper_spec.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/spec/helpers/icons_helper_spec.rb b/spec/helpers/icons_helper_spec.rb index ddefc3862ae..fddda0cd627 100644 --- a/spec/helpers/icons_helper_spec.rb +++ b/spec/helpers/icons_helper_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe IconsHelper do + let(:icons_path) { ActionController::Base.helpers.image_path("icons.svg") } + describe 'icon' do it 'returns aria-hidden by default' do star = icon('star') @@ -18,8 +20,8 @@ describe IconsHelper do describe 'sprite_icon_path' do it 'returns relative path' do - expect(sprite_icon_path()) - .to eq icons_path() + expect(sprite_icon_path) + .to eq icons_path end context 'when an asset_host is set in the config it will return an absolute local URL' do @@ -41,17 +43,17 @@ describe IconsHelper do it 'returns svg icon html' do expect(sprite_icon(icon_name).to_s) - .to eq "<svg><use xlink:href=\"#{icons_path()}##{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=\"#{icons_path()}##{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=\"#{icons_path()}#{icon_name}\"></use></svg>" + .to eq "<svg class=\"s72 icon-danger\"><use xlink:href=\"#{icons_path}##{icon_name}\"></use></svg>" end end @@ -160,8 +162,4 @@ 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") - end end |