diff options
author | Steven Thonus <steven@ln2.nl> | 2014-01-25 18:15:44 +0100 |
---|---|---|
committer | Hannes Rosenögger <123haynes@gmail.com> | 2015-01-24 18:51:16 +0100 |
commit | 42bac7f9f27b0e8fb113e452fc2106882262172d (patch) | |
tree | badf9efefbdf95e02cac54c48d1495cd062476e9 /spec | |
parent | c8c05edcd500c0a755cb6962b51f97381663bd1a (diff) | |
download | gitlab-ce-42bac7f9f27b0e8fb113e452fc2106882262172d.tar.gz |
adding avatar to project settings page added avatar removal show project avatar on dashboard, projects page, project page added rspec and feature tests added project avatar from repository new default project icon added added copying af avatar to forking of project added generated icon fixed avatar fork hound fix style fix test fix
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 22 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 15 | ||||
-rw-r--r-- | spec/routing/project_routing_spec.rb | 7 |
3 files changed, 44 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 1738f3443cf..ed50bf7c75d 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -56,6 +56,28 @@ describe ApplicationHelper do end end + describe 'project_icon' do + avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png') + + it 'should return an url for the avatar' do + project = create(:project) + project.avatar = File.open(avatar_file_path) + project.save! + project_icon(project.to_param).to_s.should == + "/uploads/project/avatar/#{ project.id }/gitlab_logo.png" + end + + it "should give uploaded icon when present" do + project = create(:project) + project.save! + + Project.any_instance.stub(:avatar_in_git).and_return(true) + + project_icon(project.to_param).to_s.should match( + image_tag(project_avatar_path(project))) + end + end + describe "avatar_icon" do avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png') diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 2a278176371..87d26f98b44 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -26,6 +26,7 @@ # star_count :integer default(0), not null # import_type :string(255) # import_source :string(255) +# avatar :string(255) # require 'spec_helper' @@ -310,4 +311,18 @@ describe Project do expect(project.star_count).to eq(0) end end + + describe :avatar_type do + let(:project) { create(:project) } + + it 'should be true if avatar is image' do + project.update_attribute(:avatar, 'uploads/avatar.png') + project.avatar_type.should be_true + end + + it 'should be false if avatar is html page' do + project.update_attribute(:avatar, 'uploads/avatar.html') + project.avatar_type.should == ['only images allowed'] + end + end end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index f149f3f62a9..67705c6cb42 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -489,4 +489,11 @@ describe Projects::ForksController, "routing" do it "to #create" do post("/gitlab/gitlabhq/fork").should route_to("projects/forks#create", project_id: 'gitlab/gitlabhq') end + +# project_avatar DELETE /project/avatar(.:format) projects/avatars#destroy +describe Projects::AvatarsController, 'routing' do + it 'to #destroy' do + delete('/gitlab/gitlabhq/avatar').should route_to( + 'projects/avatars#destroy', project_id: 'gitlab/gitlabhq') + end end |