Commit 168db043 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'cluster_management_unset' into 'master'

Allow management_project_id to be unset

See merge request gitlab-org/gitlab!19330
parents 241242af d8ad9572
......@@ -23,7 +23,7 @@ module Clusters
end
def validate_params(cluster)
if params[:management_project_id]
if params[:management_project_id].present?
management_project = management_project_scope(cluster).find_by_id(params[:management_project_id])
unless management_project
......
......@@ -138,6 +138,23 @@ describe Clusters::UpdateService do
expect(cluster.management_project_id).to be_nil
end
end
context 'cluster already has a management project set' do
before do
cluster.update!(management_project: create(:project))
end
let(:params) do
{ management_project_id: '' }
end
it 'unsets management_project_id' do
is_expected.to eq(true)
cluster.reload
expect(cluster.management_project_id).to be_nil
end
end
end
context 'project cluster' do
......
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