Commit 27577e8e authored by Tim Zallmann's avatar Tim Zallmann

Fixed Tests

parent 6168e33e
...@@ -9,11 +9,12 @@ module LazyImageTagHelper ...@@ -9,11 +9,12 @@ module LazyImageTagHelper
unless options.delete(:lazy) == false unless options.delete(:lazy) == false
options[:data] ||= {} options[:data] ||= {}
if options.delete(:use_original_source) options[:data][:src] = if options.delete(:use_original_source)
options[:data][:src] = source source
else else
options[:data][:src] = path_to_image(source) path_to_image(source)
end end
options[:class] ||= "" options[:class] ||= ""
options[:class] << " lazy" options[:class] << " lazy"
......
...@@ -60,7 +60,7 @@ describe ApplicationHelper do ...@@ -60,7 +60,7 @@ describe ApplicationHelper do
let(:asset_host) { 'http://assets' } let(:asset_host) { 'http://assets' }
it 'returns an url for the avatar' do it 'returns an url for the avatar' do
project = create(:project, avatar: File.open(uploaded_image_temp_path)) project = create(:project, :public, avatar: File.open(uploaded_image_temp_path))
avatar_url = "/uploads/-/system/project/avatar/#{project.id}/banana_sample.gif" avatar_url = "/uploads/-/system/project/avatar/#{project.id}/banana_sample.gif"
expect(helper.project_icon(project.full_path).to_s) expect(helper.project_icon(project.full_path).to_s)
......
...@@ -15,13 +15,13 @@ describe GroupsHelper do ...@@ -15,13 +15,13 @@ describe GroupsHelper do
avatar_url = "/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif" avatar_url = "/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif"
expect(group_icon(group).to_s) expect(helper.group_icon(group).to_s)
.to eq "<img data-src=\"#{avatar_url}\" class=\" lazy\" src=\"#{LazyImageTagHelper.placeholder_image}\" />" .to eq "<img data-src=\"#{avatar_url}\" class=\" lazy\" src=\"#{LazyImageTagHelper.placeholder_image}\" />"
allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) allow(ActionController::Base).to receive(:asset_host).and_return(asset_host)
avatar_url = "#{asset_host}/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif" avatar_url = "#{asset_host}/uploads/-/system/group/avatar/#{group.id}/banana_sample.gif"
expect(group_icon(group).to_s) expect(helper.group_icon(group).to_s)
.to eq "<img data-src=\"#{avatar_url}\" class=\" lazy\" src=\"#{LazyImageTagHelper.placeholder_image}\" />" .to eq "<img data-src=\"#{avatar_url}\" class=\" lazy\" src=\"#{LazyImageTagHelper.placeholder_image}\" />"
end 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