Skip to content

Commit

Permalink
Service templates should have name presence checks
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed Feb 18, 2019
1 parent 41643ca commit cc388b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/models/service_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ServiceTemplate < ApplicationRecord
include_concern 'Filter'
include_concern 'Copy'

validates :name, :presence => true
belongs_to :tenant
# # These relationships are used to specify children spawned from a parent service
# has_many :child_services, :class_name => "ServiceTemplate", :foreign_key => :service_template_id
Expand Down
16 changes: 12 additions & 4 deletions spec/factories/service_template.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
FactoryBot.define do
factory :service_template
factory :service_template_orchestration, :class => 'ServiceTemplateOrchestration', :parent => :service_template
factory :service_template_ansible_playbook, :class => 'ServiceTemplateAnsiblePlaybook', :parent => :service_template
factory :service_template_container_template, :class => 'ServiceTemplateContainerTemplate', :parent => :service_template
factory :service_template do
sequence(:name) { |n| "service_template_#{seq_padded_for_sorting(n)}" }
end
factory :service_template_orchestration, :class => 'ServiceTemplateOrchestration', :parent => :service_template do
sequence(:name) { |n| "service_template_#{seq_padded_for_sorting(n)}" }
end
factory :service_template_ansible_playbook, :class => 'ServiceTemplateAnsiblePlaybook', :parent => :service_template do
sequence(:name) { |n| "service_template_#{seq_padded_for_sorting(n)}" }
end
factory :service_template_container_template, :class => 'ServiceTemplateContainerTemplate', :parent => :service_template do
sequence(:name) { |n| "service_template_#{seq_padded_for_sorting(n)}" }
end
factory :service_template_transformation_plan, :class => 'ServiceTemplateTransformationPlan', :parent => :service_template do
sequence(:name) { |n| "service_template_#{seq_padded_for_sorting(n)}" }
end
Expand Down

0 comments on commit cc388b8

Please sign in to comment.