Add support for HiDPI displays in gravatar service

This commit is contained in:
Jan-Gerd Tenberge
2015-09-26 20:53:16 +02:00
parent 4957415e00
commit 3ef71fa4fb
2 changed files with 10 additions and 6 deletions
+8 -4
View File
@@ -141,15 +141,19 @@ describe ApplicationHelper do
stub_gravatar_setting(plain_url: 'http://example.local/?s=%{size}&hash=%{hash}')
expect(gravatar_icon(user_email, 20)).
to eq('http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118')
to eq('http://example.local/?s=40&hash=b58c6f14d292556214bd64909bcdb118')
end
it 'accepts a custom size argument' do
expect(helper.gravatar_icon(user_email, 64)).to include '?s=64'
expect(helper.gravatar_icon(user_email, 64)).to include '?s=128'
end
it 'defaults size to 40 when given an invalid size' do
expect(helper.gravatar_icon(user_email, nil)).to include '?s=40'
it 'defaults size to 40@2x when given an invalid size' do
expect(helper.gravatar_icon(user_email, nil)).to include '?s=80'
end
it 'accepts a scaling factor' do
expect(helper.gravatar_icon(user_email, 40, 3)).to include '?s=120'
end
it 'ignores case and surrounding whitespace' do