summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-06-01 17:19:17 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-06-01 17:19:17 +0000
commit97d6085fb507d53f92699d5cfea06dd319125994 (patch)
tree37a7de6bafde1c71e40a83d8615f0d23da4d90c0 /spec/services
parent950db1bd6472813bb539b69a309402c4eb115122 (diff)
parentdcd002a15bd9a3efee7b75de17c0f6d303c2a009 (diff)
downloadgitlab-ce-97d6085fb507d53f92699d5cfea06dd319125994.tar.gz
Merge branch 'dm-gravatar-username' into 'master'
Add username parameter to gravatar URL Closes #24472 See merge request !11741
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/gravatar_service_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/gravatar_service_spec.rb b/spec/services/gravatar_service_spec.rb
new file mode 100644
index 00000000000..8c4ad8c7a3e
--- /dev/null
+++ b/spec/services/gravatar_service_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe GravatarService, service: true do
+ describe '#execute' do
+ let(:url) { 'http://example.com/avatar?hash=%{hash}&size=%{size}&email=%{email}&username=%{username}' }
+
+ before do
+ allow(Gitlab.config.gravatar).to receive(:plain_url).and_return(url)
+ end
+
+ it 'replaces the placeholders' do
+ avatar_url = described_class.new.execute('user@example.com', 100, 2, username: 'user')
+
+ expect(avatar_url).to include("hash=#{Digest::MD5.hexdigest('user@example.com')}")
+ expect(avatar_url).to include("size=200")
+ expect(avatar_url).to include("email=user%40example.com")
+ expect(avatar_url).to include("username=user")
+ end
+ end
+end