Add User#avatar_type tests

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2013-12-24 10:55:45 +02:00
parent e6f83399f3
commit 62f1c97720
No known key found for this signature in database
GPG Key ID: 627C5F589F467F17
1 changed files with 14 additions and 0 deletions

View File

@ -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