diff options
author | Steven Thonus <github@popl.nl> | 2013-10-06 22:13:56 +0400 |
---|---|---|
committer | Steven Thonus <github@popl.nl> | 2013-10-09 11:05:09 +0400 |
commit | 65cad57a35002a9fd168863ae8a4d7ca045fb938 (patch) | |
tree | 61227cc71fea23b8f75852cd92452e4f2fd47179 /spec/helpers | |
parent | 358426d66164d720d793ea37bacb4fc331c30171 (diff) |
avatar upload on profile page
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 229f49659cf..0d066be5b45 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -38,6 +38,24 @@ describe ApplicationHelper do current_action?(:baz, :bar, :foo).should be_true end end + + describe "avatar_icon" do + avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png') + + it "should return an url for the avatar" do + user = create(:user) + user.avatar = File.open(avatar_file_path) + user.save! + avatar_icon(user.email).to_s.should == "/uploads/user/avatar/#{ user.id }/gitlab_logo.png" + end + + it "should call gravatar_icon when no avatar is present" do + user = create(:user) + user.save! + stub!(:gravatar_icon).and_return('gravatar_method_called') + avatar_icon(user.email).to_s.should == "gravatar_method_called" + end + end describe "gravatar_icon" do let(:user_email) { 'user@email.com' } |