From 69684c2978dd8d6b231facdf0b10db8837203016 Mon Sep 17 00:00:00 2001 From: Daniel Berger Date: Mon, 26 Aug 2019 15:14:10 -0400 Subject: [PATCH] Include the SupportsFeatureMixin in the ServiceTemplate class, and add supports :order. --- app/models/service_template.rb | 4 ++++ spec/models/service_template_spec.rb | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/app/models/service_template.rb b/app/models/service_template.rb index dad90ee8c49..59e2bc71278 100644 --- a/app/models/service_template.rb +++ b/app/models/service_template.rb @@ -1,4 +1,6 @@ class ServiceTemplate < ApplicationRecord + include SupportsFeatureMixin + DEFAULT_PROCESS_DELAY_BETWEEN_GROUPS = 120 GENERIC_ITEM_SUBTYPES = { @@ -84,6 +86,8 @@ class ServiceTemplate < ApplicationRecord scope :displayed, -> { where(:display => true) } scope :public_service_templates, -> { where(:internal => [false, nil]) } + supports :order + def self.with_tenant(tenant_id) tenant = Tenant.find(tenant_id) where(:tenant_id => tenant.ancestor_ids + [tenant_id]) diff --git a/spec/models/service_template_spec.rb b/spec/models/service_template_spec.rb index 341ab9d73fe..3d8563fa218 100644 --- a/spec/models/service_template_spec.rb +++ b/spec/models/service_template_spec.rb @@ -1113,6 +1113,13 @@ end end end + + context "#supports_order?" do + it "returns the expected boolean value" do + st = FactoryBot.create(:service_template) + expect(st.supports_order?).to eql(true) + end + end end def add_and_save_service(p, c)