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
9ac1039d
Commit
9ac1039d
authored
Jan 31, 2022
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add required_approval_count to protected environment controller
parent
e67b1bd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
ee/app/controllers/projects/protected_environments_controller.rb
...controllers/projects/protected_environments_controller.rb
+5
-1
ee/spec/controllers/projects/protected_environments_controller_spec.rb
...ollers/projects/protected_environments_controller_spec.rb
+6
-3
No files found.
ee/app/controllers/projects/protected_environments_controller.rb
View file @
9ac1039d
...
...
@@ -52,7 +52,11 @@ class Projects::ProtectedEnvironmentsController < Projects::ApplicationControlle
end
def
protected_environment_params
params
.
require
(
:protected_environment
).
permit
(
:name
,
deploy_access_levels_attributes:
deploy_access_level_attributes
)
params
.
require
(
:protected_environment
).
permit
(
:name
,
:required_approval_count
,
deploy_access_levels_attributes:
deploy_access_level_attributes
)
end
def
deploy_access_level_attributes
...
...
ee/spec/controllers/projects/protected_environments_controller_spec.rb
View file @
9ac1039d
...
...
@@ -13,7 +13,8 @@ RSpec.describe Projects::ProtectedEnvironmentsController do
describe
'#POST create'
do
let
(
:params
)
do
attributes_for
(
:protected_environment
,
deploy_access_levels_attributes:
[{
access_level:
maintainer_access
}])
deploy_access_levels_attributes:
[{
access_level:
maintainer_access
}],
required_approval_count:
1
)
end
subject
do
...
...
@@ -93,7 +94,8 @@ RSpec.describe Projects::ProtectedEnvironmentsController do
deploy_access_levels_attributes:
[
{
id:
deploy_access_level
.
id
,
access_level:
Gitlab
::
Access
::
DEVELOPER
},
{
access_level:
maintainer_access
}
]
],
required_approval_count:
3
}
end
...
...
@@ -118,8 +120,9 @@ RSpec.describe Projects::ProtectedEnvironmentsController do
expect
(
assigns
(
:protected_environment
)).
to
eq
(
protected_environment
)
end
it
'updates the protected environment'
do
it
'updates the protected environment'
,
:aggregate_failures
do
expect
(
protected_environment
.
deploy_access_levels
.
count
).
to
eq
(
2
)
expect
(
protected_environment
.
reload
.
required_approval_count
).
to
eq
(
3
)
end
it
'is successful'
do
...
...
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