BigW Consortium Gitlab

Commit 10aeb81e by Grzegorz Bizon

Merge branch 'zj-update-project-settings' into 'master'

Allow updating of project auto devops settings Closes #37893 See merge request gitlab-org/gitlab-ce!14291
parents ff594bb3 cf851ce5
......@@ -192,7 +192,7 @@ class Project < ActiveRecord::Base
accepts_nested_attributes_for :variables, allow_destroy: true
accepts_nested_attributes_for :project_feature, update_only: true
accepts_nested_attributes_for :import_data
accepts_nested_attributes_for :auto_devops
accepts_nested_attributes_for :auto_devops, update_only: true
delegate :name, to: :owner, allow_nil: true, prefix: true
delegate :members, to: :team, prefix: true
......
......@@ -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
......
require 'spec_helper'
describe Projects::PipelinesSettingsController do
set(:user) { create(:user) }
set(:project_auto_devops) { create(:project_auto_devops) }
let(:project) { project_auto_devops.project }
before do
project.add_master(user)
sign_in(user)
end
describe 'PATCH update' do
before do
patch :update,
namespace_id: project.namespace.to_param,
project_id: project,
project: {
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