Skip to content

Commit

Permalink
Merge pull request #19203 from djberg96/supports_feature_order
Browse files Browse the repository at this point in the history
Add order option to SupportsFeatureMixin module
  • Loading branch information
agrare committed Aug 26, 2019
2 parents f30f408 + 69684c2 commit baeb7ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/mixins/supports_feature_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ module SupportsFeatureMixin
:migrate => 'Migration',
:capture => 'Capture of Capacity & Utilization Metrics',
:openscap_scan => 'OpenSCAP security scan',
:order => 'Service Order',
:provisioning => 'Provisioning',
:publish => 'Publishing',
:quick_stats => 'Quick Stats',
Expand Down
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 baeb7ba

Please sign in to comment.