Commit 766dfb88 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Simplify ApplicationSettings::UpdateService#execute return value

parent 3d1c7fa0
......@@ -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
......
......@@ -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
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment