Permalink
Browse files

Merge pull request #328 from SamWhited/gravatar-ssl

Add SSL support to r:gravatar
  • Loading branch information...
2 parents 80ed663 + 442721c commit 17e01ffcd608caee74699e1a6114d038f9ac9514 @jomz jomz committed May 14, 2012
Showing with 9 additions and 9 deletions.
  1. +3 −3 app/helpers/application_helper.rb
  2. +3 −3 app/models/standard_tags.rb
  3. +3 −3 spec/models/standard_tags_spec.rb
@@ -191,9 +191,9 @@ def gravatar_url(email, options={})
unless email.blank?
# Build the Gravatar url.
- url = 'http://www.gravatar.com/avatar.php?'
- url << "gravatar_id=#{Digest::MD5.new.update(email)}"
- url << "&rating=#{options[:rating]}" if options[:rating]
+ url = '//gravatar.com/avatar/'
+ url << "#{Digest::MD5.new.update(email)}?"
+ url << "rating=#{options[:rating]}" if options[:rating]
url << "&size=#{options[:size]}" if options[:size]
url << "&default=#{options[:default]}" if options[:default]
url
@@ -734,9 +734,9 @@ class RequiredAttributeError < StandardError; end
email = User.find_by_name(name).email
default = "#{request.protocol}#{request.host_with_port}/images/admin/avatar_#{([size.to_i] * 2).join('x')}.png"
unless email.blank?
- url = 'http://www.gravatar.com/avatar.php?'
- url << "gravatar_id=#{Digest::MD5.new.update(email)}"
- url << "&rating=#{rating}"
+ url = '//gravatar.com/avatar/'
+ url << "#{Digest::MD5.new.update(email)}?"
+ url << "rating=#{rating}"
url << "&size=#{size.to_i}"
url << "&default=#{default}"
url
@@ -580,11 +580,11 @@
describe "<r:gravatar>" do
it "should render the Gravatar URL of author of the current page" do
- page.should render('<r:gravatar />').as('http://www.gravatar.com/avatar.php?gravatar_id=e64c7d89f26bd1972efa854d13d7dd61&rating=G&size=32&default=http://testhost.tld/images/admin/avatar_32x32.png')
+ page.should render('<r:gravatar />').as('//gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?rating=G&size=32&default=http://testhost.tld/images/admin/avatar_32x32.png')
end
it "should render the Gravatar URL of the name user" do
- page.should render('<r:gravatar name="Admin" />').as('http://www.gravatar.com/avatar.php?gravatar_id=e64c7d89f26bd1972efa854d13d7dd61&rating=G&size=32&default=http://testhost.tld/images/admin/avatar_32x32.png')
+ page.should render('<r:gravatar name="Admin" />').as('//gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?rating=G&size=32&default=http://testhost.tld/images/admin/avatar_32x32.png')
end
it "should render the default avatar when the user has not set an email address" do
@@ -596,7 +596,7 @@
end
it "should render the specified rating" do
- page.should render('<r:gravatar rating="X" />').as('http://www.gravatar.com/avatar.php?gravatar_id=e64c7d89f26bd1972efa854d13d7dd61&rating=X&size=32&default=http://testhost.tld/images/admin/avatar_32x32.png')
+ page.should render('<r:gravatar rating="X" />').as('//gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?rating=X&size=32&default=http://testhost.tld/images/admin/avatar_32x32.png')
end
end

0 comments on commit 17e01ff

Please sign in to comment.