diff options
author | Steven Thonus <steven@ln2.nl> | 2014-01-27 22:34:05 +0100 |
---|---|---|
committer | Steven Thonus <steven@ln2.nl> | 2014-01-28 08:38:00 +0100 |
commit | 251df827a5308d483a95242970569075ab655703 (patch) | |
tree | 00872b5ebaf24ca6c4e964172f59a8380c55d096 /spec | |
parent | 5221dbfee74e48f379bc06b2848a64243a76270c (diff) | |
download | gitlab-ce-251df827a5308d483a95242970569075ab655703.tar.gz |
added group avatars
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 17 | ||||
-rw-r--r-- | spec/models/group_spec.rb | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 3644410e46d..c58c83a2970 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -39,6 +39,23 @@ describe ApplicationHelper do end end + describe "group_icon" do + avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png') + + it "should return an url for the avatar" do + group = create(:group) + group.avatar = File.open(avatar_file_path) + group.save! + group_icon(group.path).to_s.should == "/uploads/group/avatar/#{ group.id }/gitlab_logo.png" + end + + it "should give default avatar_icon when no avatar is present" do + group = create(:group) + group.save! + group_icon(group.path).to_s.should == "/assets/no_group_avatar.png" + end + end + describe "avatar_icon" do avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png') diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 12b84700eb1..686e43d8d10 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -54,4 +54,19 @@ describe Group do group.users_groups.guests.map(&:user).should_not include(user) end end + + describe :avatar_type do + let(:user) { create(:user) } + before { group.add_user(user, UsersGroup::MASTER) } + + it "should be true if avatar is image" do + group.update_attribute(:avatar, 'uploads/avatar.png') + group.avatar_type.should be_true + end + + it "should be false if avatar is html page" do + group.update_attribute(:avatar, 'uploads/avatar.html') + group.avatar_type.should == ["only images allowed"] + end + end end |