Commit 62f1c97720f20f56a6bc4f1dd39194846953642d
1 parent
e6f83399
Exists in
spb-stable
and in
3 other branches
Add User#avatar_type tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
spec/models/user_spec.rb
... | ... | @@ -279,4 +279,18 @@ describe User do |
279 | 279 | User.by_username_or_id('bar').should be_nil |
280 | 280 | end |
281 | 281 | end |
282 | + | |
283 | + describe :avatar_type do | |
284 | + let(:user) { create(:user) } | |
285 | + | |
286 | + it "should be true if avatar is image" do | |
287 | + user.update_attribute(:avatar, 'uploads/avatar.png') | |
288 | + user.avatar_type.should be_true | |
289 | + end | |
290 | + | |
291 | + it "should be false if avatar is html page" do | |
292 | + user.update_attribute(:avatar, 'uploads/avatar.html') | |
293 | + user.avatar_type.should == ["only images allowed"] | |
294 | + end | |
295 | + end | |
282 | 296 | end | ... | ... |