Add User#avatar_type tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
e6f83399f3
commit
62f1c97720
1 changed files with 14 additions and 0 deletions
|
@ -279,4 +279,18 @@ describe User do
|
||||||
User.by_username_or_id('bar').should be_nil
|
User.by_username_or_id('bar').should be_nil
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue