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
766dfb88
Commit
766dfb88
authored
Jan 21, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify ApplicationSettings::UpdateService#execute return value
parent
3d1c7fa0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
13 deletions
+7
-13
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+4
-2
app/services/application_settings/update_service.rb
app/services/application_settings/update_service.rb
+1
-5
spec/services/application_settings/update_service_spec.rb
spec/services/application_settings/update_service_spec.rb
+2
-6
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
766dfb88
...
...
@@ -5,9 +5,11 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def
update
result
=
::
ApplicationSettings
::
UpdateService
.
new
(
@application_setting
,
current_user
,
application_setting_params
).
execute
successful
=
ApplicationSettings
::
UpdateService
.
new
(
@application_setting
,
current_user
,
application_setting_params
)
.
execute
if
result
[
:status
]
==
:success
if
successful
redirect_to
admin_application_settings_path
,
notice:
'Application settings saved successfully'
else
...
...
app/services/application_settings/update_service.rb
View file @
766dfb88
...
...
@@ -4,11 +4,7 @@ module ApplicationSettings
# Repository size limit comes as MB from the view
assign_repository_size_limit_as_bytes
(
application_setting
)
if
application_setting
.
update
(
params
)
success
else
error
(
'Application settings could not be updated'
)
end
application_setting
.
update
(
params
)
end
end
end
spec/services/application_settings/update_service_spec.rb
View file @
766dfb88
...
...
@@ -20,9 +20,7 @@ describe ApplicationSettings::UpdateService, services: true do
let
(
:opts
)
{
{
repository_size_limit:
'100'
}
}
it
'returns success params'
do
result
=
service
.
execute
expect
(
result
).
to
eql
(
status: :success
)
expect
(
service
.
execute
).
to
eql
(
true
)
end
end
...
...
@@ -30,9 +28,7 @@ describe ApplicationSettings::UpdateService, services: true do
let
(
:opts
)
{
{
repository_size_limit:
'-100'
}
}
it
'returns error params'
do
result
=
service
.
execute
expect
(
result
).
to
eql
(
message:
"Application settings could not be updated"
,
status: :error
)
expect
(
service
.
execute
).
to
eql
(
false
)
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