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
path: root/spec
diff options
context:
space:
mode:
authorAriejan de Vroom <ariejan@ariejan.net>2011-11-09 18:15:21 +0400
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-11-09 22:51:22 +0400
commit85468fb4ce47633a5996104c87d03eaa2cc0031e (patch)
tree24e76ffc9a40c683390893b8890e32511fb6c2a3 /spec
parent786fe29db4cd884ad0735d7ac2455975aff11ae8 (diff)
Use secure.gravatar.com when running over SSL
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/application_helper_spec.rb35
1 files changed, 35 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..3e174ca47ab
--- /dev/null
+++ b/spec/helpers/application_helper_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe ApplicationHelper do
+ context ".gravatar_icon" do
+ context "over http" do
+ it "returns the correct URL to www.gravatar.com" do
+ expected = "http://www.gravatar.com/avatar/f7daa65b2aa96290bb47c4d68d11fe6a?s=40&d=identicon"
+
+ # Pretend we're running over HTTP
+ helper.stub(:request) do
+ request = double('request')
+ request.stub(:ssl?) { false }
+ request
+ end
+
+ helper.gravatar_icon("admin@local.host").should == expected
+ end
+ end
+
+ context "over https" do
+ it "returns the correct URL to secure.gravatar.com" do
+ expected = "https://secure.gravatar.com/avatar/f7daa65b2aa96290bb47c4d68d11fe6a?s=40&d=identicon"
+
+ # Pretend we're running over HTTPS
+ helper.stub(:request) do
+ request = double('request')
+ request.stub(:ssl?) { true }
+ request
+ end
+
+ helper.gravatar_icon("admin@local.host").should == expected
+ end
+ end
+ end
+end