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
41e64d3c
Commit
41e64d3c
authored
Jul 02, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rubocop warnings
parent
dd328184
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
67 additions
and
68 deletions
+67
-68
spec/finders/projects_finder_spec.rb
spec/finders/projects_finder_spec.rb
+2
-2
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+7
-9
spec/lib/gitlab/ldap/person_spec.rb
spec/lib/gitlab/ldap/person_spec.rb
+3
-2
spec/lib/gitlab/satellite/merge_action_spec.rb
spec/lib/gitlab/satellite/merge_action_spec.rb
+20
-13
spec/models/ldap_group_link_spec.rb
spec/models/ldap_group_link_spec.rb
+1
-1
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+1
-3
spec/requests/api/ldap_group_links_spec.rb
spec/requests/api/ldap_group_links_spec.rb
+19
-19
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+3
-4
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+2
-3
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+3
-6
spec/services/test_hook_service_spec.rb
spec/services/test_hook_service_spec.rb
+5
-5
spec/workers/admin_emails_worker_spec.rb
spec/workers/admin_emails_worker_spec.rb
+1
-1
No files found.
spec/finders/projects_finder_spec.rb
View file @
41e64d3c
...
...
@@ -55,10 +55,10 @@ describe ProjectsFinder do
end
context
'authenticated, group member with project shared with group'
do
before
{
before
do
group
.
add_user
(
user
,
Gitlab
::
Access
::
DEVELOPER
)
project5
.
project_group_links
.
create
group_access:
Gitlab
::
Access
::
MASTER
,
group:
group
}
end
subject
{
ProjectsFinder
.
new
.
execute
(
user
,
group:
group2
)
}
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
41e64d3c
...
...
@@ -120,8 +120,9 @@ describe Gitlab::LDAP::Access do
describe
:update_ssh_keys
do
let
(
:ssh_key
)
{
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCrSQHff6a1rMqBdHFt+FwIbytMZ+hJKN3KLkTtOWtSvNIriGhnTdn4rs+tjD/w+z+revytyWnMDM9dS7J8vQi006B16+hc9Xf82crqRoPRDnBytgAFFQY1G/55ql2zdfsC5yvpDOFzuwIJq5dNGsojS82t6HNmmKPq130fzsenFnj5v1pl3OJvk513oduUyKiZBGTroWTn7H/eOPtu7s9MD7pAdEjqYKFLeaKmyidiLmLqQlCRj3Tl2U9oyFg4PYNc0bL5FZJ/Z6t0Ds3i/a2RanQiKxrvgu3GSnUKMx7WIX373baL4jeM7cprRGiOY/1NcS+1cAjfJ8oaxQF/1dYj"
}
let
(
:ssh_key_attribute_name
)
{
'altSecurityIdentities'
}
let
(
:entry
)
{
Net
::
LDAP
::
Entry
.
from_single_ldif_string
(
"dn: cn=foo, dc=bar, dc=com
\n
#{
ssh_key_attribute_name
}
: SSHKey:
#{
ssh_key
}
\n
#{
ssh_key_attribute_name
}
: KerberosKey:bogus"
)
}
let
(
:entry
)
do
Net
::
LDAP
::
Entry
.
from_single_ldif_string
(
"dn: cn=foo, dc=bar, dc=com
\n
#{
ssh_key_attribute_name
}
: SSHKey:
#{
ssh_key
}
\n
#{
ssh_key_attribute_name
}
: KerberosKey:bogus"
)
end
before
do
Gitlab
::
LDAP
::
Config
.
any_instance
.
stub
(
sync_ssh_keys:
ssh_key_attribute_name
)
...
...
@@ -289,8 +290,7 @@ objectclass: posixGroup
context
"existing access as master for group-1, not allowed"
do
before
do
gitlab_group_1
.
group_members
.
masters
.
create
(
user_id:
user
.
id
)
gitlab_group_1
.
ldap_group_links
.
create
({
cn:
'ldap-group1'
,
group_access:
Gitlab
::
Access
::
MASTER
,
provider:
'ldapmain'
})
gitlab_group_1
.
ldap_group_links
.
create
(
cn:
'ldap-group1'
,
group_access:
Gitlab
::
Access
::
MASTER
,
provider:
'ldapmain'
)
access
.
stub
(
cns_with_access:
[
'ldap-group2'
])
end
...
...
@@ -303,8 +303,7 @@ objectclass: posixGroup
context
"existing access as owner for group-1 with no other owner, not allowed"
do
before
do
gitlab_group_1
.
group_members
.
owners
.
create
(
user_id:
user
.
id
)
gitlab_group_1
.
ldap_group_links
.
create
({
cn:
'ldap-group1'
,
group_access:
Gitlab
::
Access
::
OWNER
,
provider:
'ldapmain'
})
gitlab_group_1
.
ldap_group_links
.
create
(
cn:
'ldap-group1'
,
group_access:
Gitlab
::
Access
::
OWNER
,
provider:
'ldapmain'
)
access
.
stub
(
cns_with_access:
[
'ldap-group2'
])
end
...
...
@@ -317,9 +316,8 @@ objectclass: posixGroup
context
"existing access as owner for group-1 while other owners present, not allowed"
do
before
do
owner2
=
create
(
:user
)
# a 2nd owner
gitlab_group_1
.
group_members
.
owners
.
create
([
{
user_id:
user
.
id
},
{
user_id:
owner2
.
id
}
]
)
gitlab_group_1
.
ldap_group_links
.
create
({
cn:
'ldap-group1'
,
group_access:
Gitlab
::
Access
::
OWNER
,
provider:
'ldapmain'
})
gitlab_group_1
.
group_members
.
owners
.
create
([{
user_id:
user
.
id
},
{
user_id:
owner2
.
id
}])
gitlab_group_1
.
ldap_group_links
.
create
(
cn:
'ldap-group1'
,
group_access:
Gitlab
::
Access
::
OWNER
,
provider:
'ldapmain'
)
access
.
stub
(
cns_with_access:
[
'ldap-group2'
])
end
...
...
spec/lib/gitlab/ldap/person_spec.rb
View file @
41e64d3c
...
...
@@ -6,8 +6,9 @@ describe Gitlab::LDAP::Person do
let
(
:ssh_key
)
{
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCrSQHff6a1rMqBdHFt+FwIbytMZ+hJKN3KLkTtOWtSvNIriGhnTdn4rs+tjD/w+z+revytyWnMDM9dS7J8vQi006B16+hc9Xf82crqRoPRDnBytgAFFQY1G/55ql2zdfsC5yvpDOFzuwIJq5dNGsojS82t6HNmmKPq130fzsenFnj5v1pl3OJvk513oduUyKiZBGTroWTn7H/eOPtu7s9MD7pAdEjqYKFLeaKmyidiLmLqQlCRj3Tl2U9oyFg4PYNc0bL5FZJ/Z6t0Ds3i/a2RanQiKxrvgu3GSnUKMx7WIX373baL4jeM7cprRGiOY/1NcS+1cAjfJ8oaxQF/1dYj"
}
let
(
:ssh_key_attribute_name
)
{
'altSecurityIdentities'
}
let
(
:entry
)
{
Net
::
LDAP
::
Entry
.
from_single_ldif_string
(
"dn: cn=foo, dc=bar, dc=com
\n
#{
keys
}
"
)
}
let
(
:entry
)
do
Net
::
LDAP
::
Entry
.
from_single_ldif_string
(
"dn: cn=foo, dc=bar, dc=com
\n
#{
keys
}
"
)
end
subject
{
Gitlab
::
LDAP
::
Person
.
new
(
entry
,
'ldapmain'
)
}
...
...
spec/lib/gitlab/satellite/merge_action_spec.rb
View file @
41e64d3c
...
...
@@ -109,13 +109,17 @@ describe 'Gitlab::Satellite::MergeAction' do
merge_request
.
stub
(
:should_rebase
).
and_return
(
true
)
end
it
{
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork
.
author
,
merge_request_fork
).
merge!
.
should
be_truthy
}
it
do
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork
.
author
,
merge_request_fork
).
merge!
.
should
be_truthy
end
it
{
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork_with_conflict
.
author
,
merge_request_fork_with_conflict
).
merge!
.
should
be_falsey
}
it
do
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork_with_conflict
.
author
,
merge_request_fork_with_conflict
).
merge!
.
should
be_falsey
end
end
context
'between branches'
do
...
...
@@ -123,14 +127,17 @@ describe 'Gitlab::Satellite::MergeAction' do
merge_request
.
stub
(
:should_rebase
).
and_return
(
true
)
end
it
{
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request
.
author
,
merge_request
).
merge!
.
should
be_truthy
}
it
do
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request
.
author
,
merge_request
).
merge!
.
should
be_truthy
end
it
{
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_with_conflict
.
author
,
merge_request_with_conflict
).
merge!
.
should
be_falsey
}
it
do
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_with_conflict
.
author
,
merge_request_with_conflict
).
merge!
.
should
be_falsey
end
end
end
end
spec/models/ldap_group_link_spec.rb
View file @
41e64d3c
...
...
@@ -33,4 +33,4 @@ describe LdapGroupLink do
end
end
end
end
\ No newline at end of file
end
spec/requests/api/groups_spec.rb
View file @
41e64d3c
...
...
@@ -136,9 +136,7 @@ describe API::API, api: true do
it
"creates an ldap_group_link if ldap_cn and ldap_access are supplied"
do
group_attributes
=
attributes_for
(
:group
,
ldap_cn:
'ldap-group'
,
ldap_access:
Gitlab
::
Access
::
DEVELOPER
)
expect
{
post
api
(
"/groups"
,
admin
),
group_attributes
}.
to
change
{
LdapGroupLink
.
count
}.
by
(
1
)
expect
{
post
api
(
"/groups"
,
admin
),
group_attributes
}.
to
change
{
LdapGroupLink
.
count
}.
by
(
1
)
end
end
end
...
...
spec/requests/api/ldap_group_links_spec.rb
View file @
41e64d3c
...
...
@@ -29,10 +29,10 @@ describe API::API, api: true do
context
"when a less priviledged user"
do
it
"should not allow less priviledged user to add LDAP group link"
do
expect
{
expect
do
post
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links"
,
user
),
cn:
'ldap-group4'
,
group_access:
GroupMember
::
GUEST
}
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
end
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
expect
(
response
.
status
).
to
eq
(
403
)
end
...
...
@@ -40,10 +40,10 @@ describe API::API, api: true do
context
"when owner of the group"
do
it
"should return ok and add ldap group link"
do
expect
{
expect
do
post
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links"
,
owner
),
cn:
'ldap-group3'
,
group_access:
GroupMember
::
GUEST
,
provider:
'ldap3'
}
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
1
)
end
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'cn'
]).
to
eq
(
'ldap-group3'
)
...
...
@@ -52,10 +52,10 @@ describe API::API, api: true do
end
it
"should return ok and add ldap group link even if no provider specified"
do
expect
{
expect
do
post
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links"
,
owner
),
cn:
'ldap-group3'
,
group_access:
GroupMember
::
GUEST
}
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
1
)
end
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'cn'
]).
to
eq
(
'ldap-group3'
)
...
...
@@ -95,9 +95,9 @@ describe API::API, api: true do
context
"when a less priviledged user"
do
it
"should not remove the LDAP group link"
do
expect
{
expect
do
delete
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links/ldap-group1"
,
user
)
}
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
end
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
expect
(
response
.
status
).
to
eq
(
403
)
end
...
...
@@ -105,17 +105,17 @@ describe API::API, api: true do
context
"when owner of the group"
do
it
"should remove ldap group link"
do
expect
{
expect
do
delete
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links/ldap-group1"
,
owner
)
}
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
-
1
)
end
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
-
1
)
expect
(
response
.
status
).
to
eq
(
200
)
end
it
"should return 404 if LDAP group cn not used for a LDAP group link"
do
expect
{
expect
do
delete
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links/ldap-group1356"
,
owner
)
}
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
end
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
expect
(
response
.
status
).
to
eq
(
404
)
end
...
...
@@ -132,9 +132,9 @@ describe API::API, api: true do
context
"when a less priviledged user"
do
it
"should not remove the LDAP group link"
do
expect
{
expect
do
delete
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links/ldap2/ldap-group2"
,
user
)
}
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
end
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
expect
(
response
.
status
).
to
eq
(
403
)
end
...
...
@@ -142,17 +142,17 @@ describe API::API, api: true do
context
"when owner of the group"
do
it
"should return 404 if LDAP group cn not used for a LDAP group link for the specified provider"
do
expect
{
expect
do
delete
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links/ldap1/ldap-group2"
,
owner
)
}
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
end
.
not_to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}
expect
(
response
.
status
).
to
eq
(
404
)
end
it
"should remove ldap group link"
do
expect
{
expect
do
delete
api
(
"/groups/
#{
group_with_ldap_links
.
id
}
/ldap_group_links/ldap2/ldap-group2"
,
owner
)
}
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
-
1
)
end
.
to
change
{
group_with_ldap_links
.
ldap_group_links
.
count
}.
by
(
-
1
)
expect
(
response
.
status
).
to
eq
(
200
)
end
...
...
spec/requests/api/projects_spec.rb
View file @
41e64d3c
...
...
@@ -638,10 +638,9 @@ describe API::API, api: true do
let
(
:group
)
{
create
(
:group
)
}
it
"should share project with group"
do
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/share"
,
user
),
group_id:
group
.
id
,
group_access:
Gitlab
::
Access
::
DEVELOPER
}.
to
change
{
ProjectGroupLink
.
count
}.
by
(
1
)
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/share"
,
user
),
group_id:
group
.
id
,
group_access:
Gitlab
::
Access
::
DEVELOPER
end
.
to
change
{
ProjectGroupLink
.
count
}.
by
(
1
)
response
.
status
.
should
==
201
json_response
[
'group_id'
].
should
==
group
.
id
...
...
spec/services/git_push_service_spec.rb
View file @
41e64d3c
...
...
@@ -262,8 +262,7 @@ describe GitPushService do
WebMock
.
stub_request
(
:post
,
jira_api_transition_url
)
WebMock
.
stub_request
(
:post
,
jira_api_comment_url
)
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
:body
=>
jira_issue_comments
)
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
body:
jira_issue_comments
)
WebMock
.
stub_request
(
:get
,
jira_api_project_url
)
closing_commit
.
stub
({
...
...
@@ -281,7 +280,7 @@ describe GitPushService do
end
it
"should initiate one api call to jira server to close the issue"
do
message
=
{
message
=
{
update:
{
comment:
[{
add:
{
...
...
spec/services/system_note_service_spec.rb
View file @
41e64d3c
...
...
@@ -411,8 +411,7 @@ describe SystemNoteService do
describe
"new reference"
do
before
do
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
:body
=>
jira_issue_comments
)
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
body:
jira_issue_comments
)
end
subject
{
Note
.
create_cross_reference_note
(
jira_issue
,
commit
,
author
)
}
...
...
@@ -423,8 +422,7 @@ describe SystemNoteService do
describe
"existing reference"
do
before
do
message
=
"[
#{
author
.
name
}
|http://localhost/u/
#{
author
.
username
}
] mentioned this issue in [a commit of
#{
project
.
path_with_namespace
}
|http://localhost/
#{
project
.
path_with_namespace
}
/commit/
#{
commit
.
id
}
]."
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
:body
=>
"{
\"
comments
\"
:[{
\"
body
\"
:
\"
#{
message
}
\"
}]}"
)
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
body:
"{
\"
comments
\"
:[{
\"
body
\"
:
\"
#{
message
}
\"
}]}"
)
end
subject
{
Note
.
create_cross_reference_note
(
jira_issue
,
commit
,
author
)
}
...
...
@@ -437,8 +435,7 @@ describe SystemNoteService do
before
do
jira_service_settings
WebMock
.
stub_request
(
:post
,
jira_api_comment_url
)
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
:body
=>
jira_issue_comments
)
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
body:
jira_issue_comments
)
end
after
do
...
...
spec/services/test_hook_service_spec.rb
View file @
41e64d3c
require
'spec_helper'
describe
TestHookService
do
let
(
:user
)
{
create
:user
}
let
(
:group
)
{
create
:group
}
let
(
:project
)
{
create
:project
,
group:
group
}
let
(
:project_hook
)
{
create
:project_hook
,
project:
project
}
let
(
:group_hook
)
{
create
:group_hook
,
group:
group
}
let
(
:user
)
{
create
:user
}
let
(
:group
)
{
create
:group
}
let
(
:project
)
{
create
:project
,
group:
group
}
let
(
:project_hook
)
{
create
:project_hook
,
project:
project
}
let
(
:group_hook
)
{
create
:group_hook
,
group:
group
}
describe
:execute
do
it
"should successfully execute the project hook"
do
...
...
spec/workers/admin_emails_worker_spec.rb
View file @
41e64d3c
...
...
@@ -19,4 +19,4 @@ describe AdminEmailsWorker do
expect
(
ActionMailer
::
Base
.
deliveries
.
count
).
to
eql
2
end
end
end
\ No newline at end of file
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