diff options
Diffstat (limited to 'spec/helpers/groups_helper_spec.rb')
-rw-r--r-- | spec/helpers/groups_helper_spec.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb index 40c26b6e1d5..55de03c8ed2 100644 --- a/spec/helpers/groups_helper_spec.rb +++ b/spec/helpers/groups_helper_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe GroupsHelper do include ApplicationHelper + let(:asset_host) { 'http://assets' } describe 'group_icon' do avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif') @@ -17,16 +18,14 @@ describe GroupsHelper do expect(group_icon(group).to_s) .to eq "<img data-src=\"#{avatar_url}\" class=\" lazy\" src=\"#{LazyImageTagHelper.placeholder_image}\" />" - allow(ActionController::Base).to receive(:asset_host).and_return(gitlab_host) - avatar_url = "#{gitlab_host}/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif" + allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) + avatar_url = "#{asset_host}/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif" expect(group_icon(group).to_s) .to eq "<img data-src=\"#{avatar_url}\" class=\" lazy\" src=\"#{LazyImageTagHelper.placeholder_image}\" />" end end - - describe 'group_icon_url' do avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif') @@ -39,16 +38,16 @@ describe GroupsHelper do end it 'returns an CDN url for the avatar' do - allow(ActionController::Base).to receive(:asset_host).and_return(gitlab_host) + allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) group = create(:group) group.avatar = fixture_file_upload(avatar_file_path) group.save! expect(group_icon_url(group.path).to_s) - .to match("#{gitlab_host}/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif") + .to match("#{asset_host}/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif") end it 'returns an based url for the avatar if private' do - allow(ActionController::Base).to receive(:asset_host).and_return(gitlab_host) + allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) group = create(:group) group.avatar = fixture_file_upload(avatar_file_path) group.private = true |