diff options
author | Stan Hu <stanhu@gmail.com> | 2015-11-26 19:13:28 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-11-26 19:13:28 +0300 |
commit | 2f90e71fd337c746c143f21b1806ebc71d907b62 (patch) | |
tree | 6d5fc6554c3496cd22288c654fecf7deb676df41 /spec/helpers | |
parent | 1befbbf57dddc23761558f21017294c950d6d3b7 (diff) | |
parent | 3b717c8a8c1e0f10bc06fd8501ce2423c98490d4 (diff) |
Merge pull request #9670 from janten/gravatar-retina
Add support for HiDPI displays in gravatar service
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 1dfae0fbd3f..670be75f763 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -95,9 +95,9 @@ describe ApplicationHelper do end it 'should call gravatar_icon when no User exists with the given email' do - expect(helper).to receive(:gravatar_icon).with('foo@example.com', 20) + expect(helper).to receive(:gravatar_icon).with('foo@example.com', 20, 2) - helper.avatar_icon('foo@example.com', 20) + helper.avatar_icon('foo@example.com', 20, 2) end describe 'using a User' do @@ -150,15 +150,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 |