Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
a0a1b9e5
Commit
a0a1b9e5
authored
Nov 09, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #79 from ariejan/fix_https_gravatar
Use secure.gravatar.com when running over SSL
parents
7066444f
4dbed7ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+3
-1
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+35
-0
No files found.
app/helpers/application_helper.rb
View file @
a0a1b9e5
require
'digest/md5'
module
ApplicationHelper
def
gravatar_icon
(
user_email
)
"http://www.gravatar.com/avatar/
#{
Digest
::
MD5
.
hexdigest
(
user_email
)
}
?s=40&d=identicon"
gravatar_host
=
request
.
ssl?
?
"https://secure.gravatar.com"
:
"http://www.gravatar.com"
"
#{
gravatar_host
}
/avatar/
#{
Digest
::
MD5
.
hexdigest
(
user_email
)
}
?s=40&d=identicon"
end
def
fixed_mode?
...
...
spec/helpers/application_helper_spec.rb
0 → 100644
View file @
a0a1b9e5
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment