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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
fee3c95d
Commit
fee3c95d
authored
Sep 18, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant `is_`
parent
3e83ba34
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
lib/gitlab/ldap/person.rb
lib/gitlab/ldap/person.rb
+2
-2
spec/lib/gitlab/ldap/person_spec.rb
spec/lib/gitlab/ldap/person_spec.rb
+2
-2
No files found.
lib/gitlab/ldap/person.rb
View file @
fee3c95d
...
@@ -38,7 +38,7 @@ module Gitlab
...
@@ -38,7 +38,7 @@ module Gitlab
# Returns the UID or DN in a normalized form
# Returns the UID or DN in a normalized form
def
self
.
normalize_uid_or_dn
(
uid_or_dn
)
def
self
.
normalize_uid_or_dn
(
uid_or_dn
)
if
is_
dn?
(
uid_or_dn
)
if
dn?
(
uid_or_dn
)
normalize_dn
(
uid_or_dn
)
normalize_dn
(
uid_or_dn
)
else
else
normalize_uid
(
uid_or_dn
)
normalize_uid
(
uid_or_dn
)
...
@@ -49,7 +49,7 @@ module Gitlab
...
@@ -49,7 +49,7 @@ module Gitlab
#
#
# An empty string is technically a valid DN (null DN), although we should
# An empty string is technically a valid DN (null DN), although we should
# never need to worry about that.
# never need to worry about that.
def
self
.
is_
dn?
(
uid_or_dn
)
def
self
.
dn?
(
uid_or_dn
)
uid_or_dn
.
blank?
||
uid_or_dn
.
include?
(
'='
)
uid_or_dn
.
blank?
||
uid_or_dn
.
include?
(
'='
)
end
end
...
...
spec/lib/gitlab/ldap/person_spec.rb
View file @
fee3c95d
...
@@ -96,7 +96,7 @@ describe Gitlab::LDAP::Person do
...
@@ -96,7 +96,7 @@ describe Gitlab::LDAP::Person do
it_behaves_like
'normalizes the DN'
it_behaves_like
'normalizes the DN'
end
end
describe
'.
is_
dn?'
do
describe
'.dn?'
do
where
(
:test_description
,
:given
,
:expected
)
do
where
(
:test_description
,
:given
,
:expected
)
do
'given a DN with a single RDN'
|
'uid=John C. Smith'
|
true
'given a DN with a single RDN'
|
'uid=John C. Smith'
|
true
'given a DN with multiple RDNs'
|
'uid=John C. Smith,ou=People,dc=example,dc=com'
|
true
'given a DN with multiple RDNs'
|
'uid=John C. Smith,ou=People,dc=example,dc=com'
|
true
...
@@ -110,7 +110,7 @@ describe Gitlab::LDAP::Person do
...
@@ -110,7 +110,7 @@ describe Gitlab::LDAP::Person do
with_them
do
with_them
do
it
'returns the expected boolean'
do
it
'returns the expected boolean'
do
assert_generic_test
(
test_description
,
described_class
.
is_
dn?
(
given
),
expected
)
assert_generic_test
(
test_description
,
described_class
.
dn?
(
given
),
expected
)
end
end
end
end
end
end
...
...
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