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
410dd66f
Commit
410dd66f
authored
Sep 27, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more validation specs
parent
18f4dd4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
5 deletions
+28
-5
spec/models/ldap_group_link_spec.rb
spec/models/ldap_group_link_spec.rb
+28
-5
No files found.
spec/models/ldap_group_link_spec.rb
View file @
410dd66f
...
...
@@ -4,9 +4,9 @@ describe LdapGroupLink do
let
(
:klass
)
{
described_class
}
let
(
:ldap_group_link
)
{
build
:ldap_group_link
}
describe
"validation"
do
describe
"cn"
do
it
"validates uniquiness based on group_id and provider"
do
describe
'validation'
do
describe
'cn'
do
it
'validates uniqueness based on group_id and provider'
do
create
(
:ldap_group_link
,
cn:
'group1'
,
group_id:
1
,
provider:
'ldapmain'
)
group_link
=
build
(
:ldap_group_link
,
...
...
@@ -22,13 +22,36 @@ describe LdapGroupLink do
end
end
describe
'filter'
do
it
'validates uniqueness based on group_id and provider'
do
create
(
:ldap_group_link
,
filter:
'(a=b)'
,
group_id:
1
,
provider:
'ldapmain'
,
cn:
nil
)
group_link
=
build
(
:ldap_group_link
,
filter:
'(a=b)'
,
group_id:
1
,
provider:
'ldapmain'
,
cn:
nil
)
expect
(
group_link
).
not_to
be_valid
group_link
.
group_id
=
2
expect
(
group_link
).
to
be_valid
group_link
.
group_id
=
1
group_link
.
provider
=
'ldapalt'
expect
(
group_link
).
to
be_valid
end
it
'validates the LDAP filter'
do
link
=
build
(
:ldap_group_link
,
filter:
'invalid'
,
group_id:
1
,
provider:
'ldapmain'
,
cn:
nil
)
expect
(
link
).
not_to
be_valid
end
end
describe
'provider'
do
it
"shows the set value"
do
it
'shows the set value'
do
ldap_group_link
.
provider
=
'1235'
expect
(
ldap_group_link
.
provider
).
to
eql
'1235'
end
it
"defaults to the first ldap server if empty"
do
it
'defaults to the first ldap server if empty'
do
expect
(
klass
.
new
.
provider
).
to
eql
Gitlab
::
LDAP
::
Config
.
providers
.
first
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