Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-26 18:56:08 +0300
committerDouwe Maan <douwe@selenight.nl>2017-06-01 18:07:24 +0300
commitdcd002a15bd9a3efee7b75de17c0f6d303c2a009 (patch)
tree3fd8d97ccfa808bcaa59ee13c0b1450fbc7539ec /spec/services/gravatar_service_spec.rb
parentbd259d6bab4b3c9856be6c3d2e0c16e0836c9380 (diff)
Add username parameter to gravatar URL
Diffstat (limited to 'spec/services/gravatar_service_spec.rb')
-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