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:
authorRobert Speicher <rspeicher@gmail.com>2012-08-16 05:06:08 +0400
committerRobert Speicher <rspeicher@gmail.com>2012-08-16 05:06:08 +0400
commit65bcc41f3e0a8b678e201e7f3d6a63c5b463fbe3 (patch)
tree19585b0ee8e01376f3a1e755febd2cb0d21bb3ab /spec/helpers/application_helper_spec.rb
parent0456dd72e26aaba6455e851260426d0156ba159a (diff)
Allow disabling Gravatars in gitlab.yml settings
Closes #1237
Diffstat (limited to 'spec/helpers/application_helper_spec.rb')
-rw-r--r--spec/helpers/application_helper_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
new file mode 100644
index 00000000000..9a2df31479c
--- /dev/null
+++ b/spec/helpers/application_helper_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe ApplicationHelper do
+ describe "gravatar_icon" do
+ let(:user_email) { 'user@email.com' }
+
+ it "should return a generic avatar path when Gravatar is disabled" do
+ Gitlab.config.stub(:disable_gravatar?).and_return(true)
+ gravatar_icon(user_email).should == 'no_avatar.png'
+ end
+
+ it "should return a generic avatar path when email is blank" do
+ gravatar_icon('').should == 'no_avatar.png'
+ end
+
+ it "should use SSL when appropriate" do
+ stub!(:request).and_return(double(:ssl? => true))
+ gravatar_icon(user_email).should match('https://secure.gravatar.com')
+ end
+
+ it "should accept a custom size" do
+ stub!(:request).and_return(double(:ssl? => false))
+ gravatar_icon(user_email, 64).should match(/\?s=64/)
+ end
+ end
+end