Skip to content
Snippets Groups Projects
Commit fe942545 authored by Stan Hu's avatar Stan Hu
Browse files

Fix avatar tests to use banana_sample.gif since SVG is not supported

parent bcb07929
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,7 +2,7 @@
 
The source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible.
 
# ![logo](https://about.gitlab.com/images/gitlab_logo.png) GitLab
# ![logo](https://about.gitlab.com/images/logo.svg) GitLab
 
## Open source software to collaborate on code
 
Loading
Loading
@@ -101,4 +101,4 @@ Please see [Getting help for GitLab](https://about.gitlab.com/getting-help/) on
## Is it awesome?
 
Thanks for [asking this question](https://twitter.com/supersloth/status/489462789384056832) Joshua.
[These people](https://twitter.com/gitlab/favorites) seem to like it.
\ No newline at end of file
[These people](https://twitter.com/gitlab/favorites) seem to like it.
Loading
Loading
@@ -128,14 +128,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
 
step 'I change group "Owned" avatar' do
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
click_button "Save group"
Group.find_by(name: "Owned").reload
end
 
step 'I should see new group "Owned" avatar' do
expect(Group.find_by(name: "Owned").avatar).to be_instance_of AvatarUploader
expect(Group.find_by(name: "Owned").avatar.url).to eq "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png"
expect(Group.find_by(name: "Owned").avatar.url).to eq "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/banana_sample.gif"
end
 
step 'I should see the "Remove avatar" button' do
Loading
Loading
@@ -143,7 +143,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
 
step 'I have group "Owned" avatar' do
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
click_button "Save group"
Group.find_by(name: "Owned").reload
end
Loading
Loading
Loading
Loading
@@ -27,14 +27,14 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
 
step 'I change my avatar' do
attach_file(:user_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
attach_file(:user_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
click_button "Save changes"
@user.reload
end
 
step 'I should see new avatar' do
expect(@user.avatar).to be_instance_of AvatarUploader
expect(@user.avatar.url).to eq "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png"
expect(@user.avatar.url).to eq "/uploads/user/avatar/#{ @user.id }/banana_sample.gif"
end
 
step 'I should see the "Remove avatar" button' do
Loading
Loading
@@ -42,7 +42,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
 
step 'I have an avatar' do
attach_file(:user_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
attach_file(:user_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
click_button "Save changes"
@user.reload
end
Loading
Loading
Loading
Loading
@@ -28,7 +28,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step 'I change the project avatar' do
attach_file(
:project_avatar,
File.join(Rails.root, 'public', 'gitlab_logo.png')
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
)
click_button 'Save changes'
@project.reload
Loading
Loading
@@ -37,7 +37,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step 'I should see new project avatar' do
expect(@project.avatar).to be_instance_of AvatarUploader
url = @project.avatar.url
expect(url).to eq "/uploads/project/avatar/#{ @project.id }/gitlab_logo.png"
expect(url).to eq "/uploads/project/avatar/#{ @project.id }/banana_sample.gif"
end
 
step 'I should see the "Remove avatar" button' do
Loading
Loading
@@ -47,7 +47,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step 'I have an project avatar' do
attach_file(
:project_avatar,
File.join(Rails.root, 'public', 'gitlab_logo.png')
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
)
click_button 'Save changes'
@project.reload
Loading
Loading
Loading
Loading
@@ -40,15 +40,15 @@ describe ApplicationHelper do
end
 
describe 'project_icon' do
avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png')
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
 
it 'should return an url for the avatar' do
project = create(:project)
project.avatar = File.open(avatar_file_path)
project.save!
avatar_url = "http://localhost/uploads/project/avatar/#{ project.id }/gitlab_logo.png"
avatar_url = "http://localhost/uploads/project/avatar/#{ project.id }/banana_sample.gif"
expect(project_icon("#{project.namespace.to_param}/#{project.to_param}").to_s).to eq(
"<img alt=\"Gitlab logo\" src=\"#{avatar_url}\" />"
"<img alt=\"Banana sample\" src=\"#{avatar_url}\" />"
)
end
 
Loading
Loading
@@ -65,14 +65,14 @@ describe ApplicationHelper do
end
 
describe 'avatar_icon' do
avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png')
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
 
it 'should return an url for the avatar' do
user = create(:user)
user.avatar = File.open(avatar_file_path)
user.save!
expect(avatar_icon(user.email).to_s).
to match("/uploads/user/avatar/#{ user.id }/gitlab_logo.png")
to match("/uploads/user/avatar/#{ user.id }/banana_sample.gif")
end
 
it 'should return an url for the avatar with relative url' do
Loading
Loading
@@ -83,7 +83,7 @@ describe ApplicationHelper do
user.avatar = File.open(avatar_file_path)
user.save!
expect(avatar_icon(user.email).to_s).
to match("/gitlab/uploads/user/avatar/#{ user.id }/gitlab_logo.png")
to match("/gitlab/uploads/user/avatar/#{ user.id }/banana_sample.gif")
end
 
it 'should call gravatar_icon when no avatar is present' do
Loading
Loading
Loading
Loading
@@ -2,14 +2,14 @@ require 'spec_helper'
 
describe GroupsHelper do
describe 'group_icon' do
avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png')
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
 
it 'should return an url for the avatar' do
group = create(:group)
group.avatar = File.open(avatar_file_path)
group.save!
expect(group_icon(group.path).to_s).
to match("/uploads/group/avatar/#{ group.id }/gitlab_logo.png")
to match("/uploads/group/avatar/#{ group.id }/banana_sample.gif")
end
 
it 'should give default avatar_icon when no avatar is present' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment