summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2017-10-04 13:58:32 +0200
committerTim Zallmann <tzallmann@gitlab.com>2017-10-04 14:27:09 +0200
commit27577e8e2b7bf18c0dbc402e5efad4905c5a154c (patch)
tree1ee6664b53459d48b9d29b59991c24e705e18143
parent6168e33e9e2f327f078e07b71c466dcc9fa9813a (diff)
downloadgitlab-ce-27577e8e2b7bf18c0dbc402e5efad4905c5a154c.tar.gz
Fixed Tests
-rw-r--r--app/helpers/lazy_image_tag_helper.rb11
-rw-r--r--spec/helpers/application_helper_spec.rb2
-rw-r--r--spec/helpers/groups_helper_spec.rb4
3 files changed, 9 insertions, 8 deletions
diff --git a/app/helpers/lazy_image_tag_helper.rb b/app/helpers/lazy_image_tag_helper.rb
index 4def806f1c0..2b5e9a9ef57 100644
--- a/app/helpers/lazy_image_tag_helper.rb
+++ b/app/helpers/lazy_image_tag_helper.rb
@@ -9,11 +9,12 @@ module LazyImageTagHelper
unless options.delete(:lazy) == false
options[:data] ||= {}
- if options.delete(:use_original_source)
- options[:data][:src] = source
- else
- options[:data][:src] = path_to_image(source)
- end
+ options[:data][:src] = if options.delete(:use_original_source)
+ source
+ else
+ path_to_image(source)
+ end
+
options[:class] ||= ""
options[:class] << " lazy"
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 6dafd73d337..87ae1fa5660 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -60,7 +60,7 @@ describe ApplicationHelper do
let(:asset_host) { 'http://assets' }
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"
expect(helper.project_icon(project.full_path).to_s)
diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb
index 4fe50d120d7..97f0ed4904e 100644
--- a/spec/helpers/groups_helper_spec.rb
+++ b/spec/helpers/groups_helper_spec.rb
@@ -15,13 +15,13 @@ describe GroupsHelper do
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}\" />"
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)
+ expect(helper.group_icon(group).to_s)
.to eq "<img data-src=\"#{avatar_url}\" class=\" lazy\" src=\"#{LazyImageTagHelper.placeholder_image}\" />"
end
end