Commit fe942545 authored by Stan Hu's avatar Stan Hu

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

parent bcb07929
...@@ -2,7 +2,7 @@ ...@@ -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. 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 ## Open source software to collaborate on code
...@@ -101,4 +101,4 @@ Please see [Getting help for GitLab](https://about.gitlab.com/getting-help/) on ...@@ -101,4 +101,4 @@ Please see [Getting help for GitLab](https://about.gitlab.com/getting-help/) on
## Is it awesome? ## Is it awesome?
Thanks for [asking this question](https://twitter.com/supersloth/status/489462789384056832) Joshua. Thanks for [asking this question](https://twitter.com/supersloth/status/489462789384056832) Joshua.
[These people](https://twitter.com/gitlab/favorites) seem to like it. [These people](https://twitter.com/gitlab/favorites) seem to like it.
\ No newline at end of file
...@@ -128,14 +128,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -128,14 +128,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end end
step 'I change group "Owned" avatar' do 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" click_button "Save group"
Group.find_by(name: "Owned").reload Group.find_by(name: "Owned").reload
end end
step 'I should see new group "Owned" avatar' do 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).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 end
step 'I should see the "Remove avatar" button' do step 'I should see the "Remove avatar" button' do
...@@ -143,7 +143,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -143,7 +143,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end end
step 'I have group "Owned" avatar' do 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" click_button "Save group"
Group.find_by(name: "Owned").reload Group.find_by(name: "Owned").reload
end end
......
...@@ -27,14 +27,14 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -27,14 +27,14 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I change my avatar' do 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" click_button "Save changes"
@user.reload @user.reload
end end
step 'I should see new avatar' do step 'I should see new avatar' do
expect(@user.avatar).to be_instance_of AvatarUploader 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 end
step 'I should see the "Remove avatar" button' do step 'I should see the "Remove avatar" button' do
...@@ -42,7 +42,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps ...@@ -42,7 +42,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end end
step 'I have an avatar' do 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" click_button "Save changes"
@user.reload @user.reload
end end
......
...@@ -28,7 +28,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -28,7 +28,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step 'I change the project avatar' do step 'I change the project avatar' do
attach_file( attach_file(
:project_avatar, :project_avatar,
File.join(Rails.root, 'public', 'gitlab_logo.png') File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
) )
click_button 'Save changes' click_button 'Save changes'
@project.reload @project.reload
...@@ -37,7 +37,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -37,7 +37,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step 'I should see new project avatar' do step 'I should see new project avatar' do
expect(@project.avatar).to be_instance_of AvatarUploader expect(@project.avatar).to be_instance_of AvatarUploader
url = @project.avatar.url 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 end
step 'I should see the "Remove avatar" button' do step 'I should see the "Remove avatar" button' do
...@@ -47,7 +47,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -47,7 +47,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step 'I have an project avatar' do step 'I have an project avatar' do
attach_file( attach_file(
:project_avatar, :project_avatar,
File.join(Rails.root, 'public', 'gitlab_logo.png') File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
) )
click_button 'Save changes' click_button 'Save changes'
@project.reload @project.reload
......
...@@ -40,15 +40,15 @@ describe ApplicationHelper do ...@@ -40,15 +40,15 @@ describe ApplicationHelper do
end end
describe 'project_icon' do 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 it 'should return an url for the avatar' do
project = create(:project) project = create(:project)
project.avatar = File.open(avatar_file_path) project.avatar = File.open(avatar_file_path)
project.save! 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( 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 end
...@@ -65,14 +65,14 @@ describe ApplicationHelper do ...@@ -65,14 +65,14 @@ describe ApplicationHelper do
end end
describe 'avatar_icon' do 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 it 'should return an url for the avatar' do
user = create(:user) user = create(:user)
user.avatar = File.open(avatar_file_path) user.avatar = File.open(avatar_file_path)
user.save! user.save!
expect(avatar_icon(user.email).to_s). 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 end
it 'should return an url for the avatar with relative url' do it 'should return an url for the avatar with relative url' do
...@@ -83,7 +83,7 @@ describe ApplicationHelper do ...@@ -83,7 +83,7 @@ describe ApplicationHelper do
user.avatar = File.open(avatar_file_path) user.avatar = File.open(avatar_file_path)
user.save! user.save!
expect(avatar_icon(user.email).to_s). 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 end
it 'should call gravatar_icon when no avatar is present' do it 'should call gravatar_icon when no avatar is present' do
......
...@@ -2,14 +2,14 @@ require 'spec_helper' ...@@ -2,14 +2,14 @@ require 'spec_helper'
describe GroupsHelper do describe GroupsHelper do
describe 'group_icon' 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 it 'should return an url for the avatar' do
group = create(:group) group = create(:group)
group.avatar = File.open(avatar_file_path) group.avatar = File.open(avatar_file_path)
group.save! group.save!
expect(group_icon(group.path).to_s). 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 end
it 'should give default avatar_icon when no avatar is present' do it 'should give default avatar_icon when no avatar is present' do
......
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