Skip to content

Commit

Permalink
Include the SupportsFeatureMixin in the ServiceTemplate class, and ad…
Browse files Browse the repository at this point in the history
…d supports :order.
  • Loading branch information
Daniel Berger committed Aug 26, 2019
1 parent a73a816 commit 69684c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/service_template.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ServiceTemplate < ApplicationRecord
include SupportsFeatureMixin

DEFAULT_PROCESS_DELAY_BETWEEN_GROUPS = 120

GENERIC_ITEM_SUBTYPES = {
Expand Down Expand Up @@ -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])
Expand Down
7 changes: 7 additions & 0 deletions spec/models/service_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 69684c2

Please sign in to comment.