Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-24 12:55:45 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-24 12:55:45 +0400
commit62f1c97720f20f56a6bc4f1dd39194846953642d (patch)
treebf0ea000008701149060dbae7719e478aab7b728 /spec/models/user_spec.rb
parente6f83399f3e5d3f245428d2495552317eefe8cfe (diff)
Add User#avatar_type tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 59f75ae552a..94bd19f5900 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -279,4 +279,18 @@ describe User do
User.by_username_or_id('bar').should be_nil
end
end
+
+ describe :avatar_type do
+ let(:user) { create(:user) }
+
+ it "should be true if avatar is image" do
+ user.update_attribute(:avatar, 'uploads/avatar.png')
+ user.avatar_type.should be_true
+ end
+
+ it "should be false if avatar is html page" do
+ user.update_attribute(:avatar, 'uploads/avatar.html')
+ user.avatar_type.should == ["only images allowed"]
+ end
+ end
end