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
2f7ae046
Commit
2f7ae046
authored
Apr 23, 2020
by
manojmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address code review comments
This change addresses code review comments
parent
2b3c511c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
21 deletions
+6
-21
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+2
-6
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+2
-6
spec/services/groups/create_service_spec.rb
spec/services/groups/create_service_spec.rb
+1
-6
spec/services/groups/update_service_spec.rb
spec/services/groups/update_service_spec.rb
+1
-3
No files found.
spec/controllers/groups_controller_spec.rb
View file @
2f7ae046
...
...
@@ -290,12 +290,10 @@ describe GroupsController do
end
context
'for users who do not have the ability to create a group with `default_branch_protection`'
do
before
do
it
'does not create the group with the specified branch protection level'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:create_group_with_default_branch_protection
)
{
false
}
end
it
'does not create the group with the specified branch protection level'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
...
...
@@ -471,12 +469,10 @@ describe GroupsController do
end
context
'for users who do not have the ability to update default_branch_protection'
do
before
do
it
'does not update the attribute'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:update_default_branch_protection
,
group
)
{
false
}
end
it
'does not update the attribute'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
...
...
spec/requests/api/groups_spec.rb
View file @
2f7ae046
...
...
@@ -657,12 +657,10 @@ describe API::Groups do
end
context
'for users who does not have the ability to update default_branch_protection`'
do
before
do
it
'does not update the attribute'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user1
,
:update_default_branch_protection
,
group1
)
{
false
}
end
it
'does not update the attribute'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -1155,12 +1153,10 @@ describe API::Groups do
end
context
'for users who do not have the ability to create a group with `default_branch_protection`'
do
before
do
it
'does not create the group with the specified branch protection level'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user3
,
:create_group_with_default_branch_protection
)
{
false
}
end
it
'does not create the group with the specified branch protection level'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
...
...
spec/services/groups/create_service_spec.rb
View file @
2f7ae046
...
...
@@ -29,9 +29,6 @@ describe Groups::CreateService, '#execute' do
let
(
:service
)
{
described_class
.
new
(
user
,
params
)
}
let
(
:created_group
)
{
service
.
execute
}
before
do
end
context
'for users who have the ability to create a group with `default_branch_protection`'
do
it
'creates group with the specified branch protection level'
do
expect
(
created_group
.
default_branch_protection
).
to
eq
(
Gitlab
::
Access
::
PROTECTION_NONE
)
...
...
@@ -39,12 +36,10 @@ describe Groups::CreateService, '#execute' do
end
context
'for users who do not have the ability to create a group with `default_branch_protection`'
do
before
do
it
'does not create the group with the specified branch protection level'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:create_group_with_default_branch_protection
)
{
false
}
end
it
'does not create the group with the specified branch protection level'
do
expect
(
created_group
.
default_branch_protection
).
not_to
eq
(
Gitlab
::
Access
::
PROTECTION_NONE
)
end
end
...
...
spec/services/groups/update_service_spec.rb
View file @
2f7ae046
...
...
@@ -154,11 +154,9 @@ describe Groups::UpdateService do
end
context
'for users who have the ability to update default_branch_protection'
do
before
do
it
'updates the attribute'
do
internal_group
.
add_owner
(
user
)
end
it
'updates the attribute'
do
expect
{
service
.
execute
}.
to
change
{
internal_group
.
default_branch_protection
}.
to
(
Gitlab
::
Access
::
PROTECTION_NONE
)
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