Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
507bd813
Commit
507bd813
authored
Feb 26, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce differences in spec/support/helpers/ldap_helpers.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
fbfe1154
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
ee/spec/support/helpers/ee/ldap_helpers.rb
ee/spec/support/helpers/ee/ldap_helpers.rb
+6
-0
spec/support/helpers/ldap_helpers.rb
spec/support/helpers/ldap_helpers.rb
+2
-8
No files found.
ee/spec/support/helpers/ee/ldap_helpers.rb
View file @
507bd813
...
@@ -4,6 +4,12 @@ module EE
...
@@ -4,6 +4,12 @@ module EE
EE
::
Gitlab
::
Auth
::
LDAP
::
Sync
::
Proxy
.
new
(
provider
,
adapter
)
EE
::
Gitlab
::
Auth
::
LDAP
::
Sync
::
Proxy
.
new
(
provider
,
adapter
)
end
end
def
fake_ldap_sync_proxy
(
provider
)
fake_proxy
=
double
(
:proxy
,
adapter:
ldap_adapter
)
allow
(
::
EE
::
Gitlab
::
Auth
::
LDAP
::
Sync
::
Proxy
).
to
receive
(
:open
).
with
(
provider
).
and_yield
(
fake_proxy
)
fake_proxy
end
# Stub an LDAP group search and provide the return entry. Specify `nil` for
# Stub an LDAP group search and provide the return entry. Specify `nil` for
# `entry` to simulate when an LDAP group is not found
# `entry` to simulate when an LDAP group is not found
#
#
...
...
spec/support/helpers/ldap_helpers.rb
View file @
507bd813
module
LdapHelpers
module
LdapHelpers
include
EE
::
LdapHelpers
def
ldap_adapter
(
provider
=
'ldapmain'
,
ldap
=
double
(
:ldap
))
def
ldap_adapter
(
provider
=
'ldapmain'
,
ldap
=
double
(
:ldap
))
::
Gitlab
::
Auth
::
LDAP
::
Adapter
.
new
(
provider
,
ldap
)
::
Gitlab
::
Auth
::
LDAP
::
Adapter
.
new
(
provider
,
ldap
)
end
end
def
fake_ldap_sync_proxy
(
provider
)
fake_proxy
=
double
(
:proxy
,
adapter:
ldap_adapter
)
allow
(
::
EE
::
Gitlab
::
Auth
::
LDAP
::
Sync
::
Proxy
).
to
receive
(
:open
).
with
(
provider
).
and_yield
(
fake_proxy
)
fake_proxy
end
def
user_dn
(
uid
)
def
user_dn
(
uid
)
"uid=
#{
uid
}
,ou=users,dc=example,dc=com"
"uid=
#{
uid
}
,ou=users,dc=example,dc=com"
end
end
...
@@ -76,3 +68,5 @@ module LdapHelpers
...
@@ -76,3 +68,5 @@ module LdapHelpers
.
to
receive
(
:ldap_search
).
and_raise
(
Gitlab
::
Auth
::
LDAP
::
LDAPConnectionError
)
.
to
receive
(
:ldap_search
).
and_raise
(
Gitlab
::
Auth
::
LDAP
::
LDAPConnectionError
)
end
end
end
end
LdapHelpers
.
include
(
EE
::
LdapHelpers
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment