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
Tatuya Kamada
gitlab-ce
Commits
5b84708d
Commit
5b84708d
authored
Mar 30, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tc-cleanup-application-settings-spec' into 'master'
Cleanup application settings spec See merge request !10189
parents
c7403521
5058fc67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+0
-9
spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+18
-7
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
5b84708d
...
...
@@ -45,15 +45,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def
application_setting_params
restricted_levels
=
params
[
:application_setting
][
:restricted_visibility_levels
]
if
restricted_levels
.
nil?
params
[
:application_setting
][
:restricted_visibility_levels
]
=
[]
else
restricted_levels
.
map!
do
|
level
|
level
.
to_i
end
end
import_sources
=
params
[
:application_setting
][
:import_sources
]
if
import_sources
.
nil?
params
[
:application_setting
][
:import_sources
]
=
[]
...
...
spec/controllers/admin/application_settings_controller_spec.rb
View file @
5b84708d
...
...
@@ -6,23 +6,34 @@ describe Admin::ApplicationSettingsController do
let
(
:admin
)
{
create
(
:admin
)
}
before
do
sign_in
(
admin
)
stub_env
(
'IN_MEMORY_APPLICATION_SETTINGS'
,
'false'
)
end
describe
'PATCH #update'
do
describe
'PUT #update'
do
before
do
sign_in
(
admin
)
end
it
'updates the default_project_visibility for string value'
do
patch
:update
,
application_setting:
{
default_project_visibility:
"20"
}
put
:update
,
application_setting:
{
default_project_visibility:
"20"
}
expect
(
response
).
to
redirect_to
(
admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
default_project_visibility
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
it
'update the restricted levels for string values'
do
put
:update
,
application_setting:
{
restricted_visibility_levels:
%w[10 20]
}
expect
(
response
).
to
redirect_to
(
admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
default_project_visibility
).
to
eq
Gitlab
::
VisibilityLevel
::
PUBLIC
expect
(
ApplicationSetting
.
current
.
restricted_visibility_levels
).
to
eq
([
10
,
20
])
end
it
'falls back to default
with default_project_visibility setting is
omitted'
do
p
atch
:update
,
application_setting:
{}
it
'falls back to default
s when settings are
omitted'
do
p
ut
:update
,
application_setting:
{}
expect
(
response
).
to
redirect_to
(
admin_application_settings_path
)
expect
(
ApplicationSetting
.
current
.
default_project_visibility
).
to
eq
Gitlab
::
VisibilityLevel
::
PRIVATE
expect
(
ApplicationSetting
.
current
.
default_project_visibility
).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
ApplicationSetting
.
current
.
restricted_visibility_levels
).
to
be_empty
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