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 ...@@ -5,9 +5,11 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end end
def update 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, redirect_to admin_application_settings_path,
notice: 'Application settings saved successfully' notice: 'Application settings saved successfully'
else else
......
...@@ -4,11 +4,7 @@ module ApplicationSettings ...@@ -4,11 +4,7 @@ module ApplicationSettings
# Repository size limit comes as MB from the view # Repository size limit comes as MB from the view
assign_repository_size_limit_as_bytes(application_setting) assign_repository_size_limit_as_bytes(application_setting)
if application_setting.update(params) application_setting.update(params)
success
else
error('Application settings could not be updated')
end
end end
end end
end end
...@@ -20,9 +20,7 @@ describe ApplicationSettings::UpdateService, services: true do ...@@ -20,9 +20,7 @@ describe ApplicationSettings::UpdateService, services: true do
let(:opts) { { repository_size_limit: '100' } } let(:opts) { { repository_size_limit: '100' } }
it 'returns success params' do it 'returns success params' do
result = service.execute expect(service.execute).to eql(true)
expect(result).to eql(status: :success)
end end
end end
...@@ -30,9 +28,7 @@ describe ApplicationSettings::UpdateService, services: true do ...@@ -30,9 +28,7 @@ describe ApplicationSettings::UpdateService, services: true do
let(:opts) { { repository_size_limit: '-100' } } let(:opts) { { repository_size_limit: '-100' } }
it 'returns error params' do it 'returns error params' do
result = service.execute expect(service.execute).to eql(false)
expect(result).to eql(message: "Application settings could not be updated", status: :error)
end end
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