summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/oauth
diff options
context:
space:
mode:
authorJan-Willem van der Meer <mail@jewilmeer.nl>2014-08-29 17:29:42 +0200
committerJan-Willem van der Meer <mail@jewilmeer.nl>2014-08-29 17:30:42 +0200
commit0d5ae2802e887dcd95fe537a59450a2c0f548382 (patch)
tree5b65aaf99fe126f6361f36083261789b0143330f /spec/lib/gitlab/oauth
parent97547428bd481b984a4c5513931617db0d890ee5 (diff)
downloadgitlab-ce-0d5ae2802e887dcd95fe537a59450a2c0f548382.tar.gz
Move and rename ldap / oauth specs
Diffstat (limited to 'spec/lib/gitlab/oauth')
-rw-r--r--spec/lib/gitlab/oauth/user_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/lib/gitlab/oauth/user_spec.rb b/spec/lib/gitlab/oauth/user_spec.rb
new file mode 100644
index 00000000000..2f15b5e0349
--- /dev/null
+++ b/spec/lib/gitlab/oauth/user_spec.rb
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe Gitlab::OAuth::User do
+ let(:gl_auth) { Gitlab::OAuth::User }
+
+ before do
+ Gitlab.config.stub(omniauth: {})
+
+ @info = double(
+ uid: '12djsak321',
+ nickname: 'john',
+ name: 'John',
+ email: 'john@mail.com'
+ )
+ end
+
+ describe :create do
+ it "should create user from LDAP" do
+ @auth = double(info: @info, provider: 'ldap')
+ user = gl_auth.create(@auth)
+
+ user.should be_valid
+ user.extern_uid.should == @info.uid
+ user.provider.should == 'ldap'
+ end
+
+ it "should create user from Omniauth" do
+ @auth = double(info: @info, provider: 'twitter')
+ user = gl_auth.create(@auth)
+
+ user.should be_valid
+ user.extern_uid.should == @info.uid
+ user.provider.should == 'twitter'
+ end
+
+ it "should apply defaults to user" do
+ @auth = double(info: @info, provider: 'ldap')
+ user = gl_auth.create(@auth)
+
+ user.should be_valid
+ user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
+ user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
+ end
+ end
+end