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:
Diffstat (limited to 'spec/helpers/application_helper_spec.rb')
-rw-r--r--spec/helpers/application_helper_spec.rb18
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' }