Commit cf851ce5 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Fix instance default option being true as value

When a user selected 'Instance default' as value for the auto devops
settings, this was interpreted as a true value. Now we post an empty
string in this case, meaning we want to set `NULL` in the database.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/37893#note_40541294
parent 65e5888f
......@@ -25,8 +25,8 @@
%span.descr
A specific .gitlab-ci.yml file needs to be specified before you can begin using Continious Integration and Delivery.
.radio
= form.label :enabled do
= form.radio_button :enabled, nil
= form.label :enabled_nil do
= form.radio_button :enabled, ''
%strong
Instance default (status: #{current_application_settings.auto_devops_enabled?})
%br
......
......@@ -17,15 +17,27 @@ describe Projects::PipelinesSettingsController do
namespace_id: project.namespace.to_param,
project_id: project,
project: {
auto_devops_attributes: { enabled: false, domain: 'mempmep.md' }
auto_devops_attributes: params
}
end
context 'when updating the auto_devops settings' do
let(:params) { { enabled: '', domain: 'mepmep.md' } }
it 'redirects to the settings page' do
expect(response).to have_http_status(302)
expect(flash[:notice]).to eq("Pipelines settings for '#{project.name}' were successfully updated.")
end
context 'following the instance default' do
let(:params) { { enabled: '' } }
it 'allows enabled to be set to nil' do
project_auto_devops.reload
expect(project_auto_devops.enabled).to be_nil
end
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