Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add order option to SupportsFeatureMixin module #19203

Merged
merged 2 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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