summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/oauth/user_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/oauth/user_spec.rb b/spec/lib/gitlab/oauth/user_spec.rb
index d6ac0c0896b..7dcc849454b 100644
--- a/spec/lib/gitlab/oauth/user_spec.rb
+++ b/spec/lib/gitlab/oauth/user_spec.rb
@@ -68,5 +68,17 @@ describe Gitlab::OAuth::User do
user = gl_auth.create(auth)
expect(user.email).to_not be_empty
end
+
+ it 'generates a username if non provided (google)' do
+ info = double(
+ uid: 'my-uid',
+ name: 'John',
+ email: 'john@example.com'
+ )
+ auth = double(info: info, provider: 'my-provider')
+
+ user = gl_auth.create(auth)
+ expect(user.username).to eql 'john'
+ end
end
end