Skip to content
Snippets Groups Projects
Unverified Commit 7e34a19f authored by Douwe Maan's avatar Douwe Maan
Browse files

Check whether new service created from template is valid after unflagging it as a template

parent 3f784d8f
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -281,9 +281,9 @@ class Service < ActiveRecord::Base
 
def self.build_from_template(project_id, template)
service = template.dup
service.active = false unless service.valid?
service.template = false
service.project_id = project_id
service.active = false if service.active? && !service.valid?
service
end
 
Loading
Loading
Loading
Loading
@@ -78,7 +78,7 @@ describe Service do
context 'when template is invalid' do
it 'sets service template to inactive when template is invalid' do
project = create(:project)
template = JiraService.new(template: true, active: true)
template = KubernetesService.new(template: true, active: true)
template.save(validate: false)
 
service = described_class.build_from_template(project.id, template)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment