Skip to content

Commit

Permalink
convert alias orderable to method
Browse files Browse the repository at this point in the history
method supports_order? is no longer available, so changing aliases

ui-classic calls `validate_{action}`, so it is possibly used
ServiceTemplate and OrchestrationTemplate call `orderable?`
Leaving that around
  • Loading branch information
kbrock committed Feb 9, 2024
1 parent 7df1e55 commit 754d3e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions app/models/service_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ class ServiceTemplate < ApplicationRecord
'Service template is not configured to be displayed'
end
end
alias orderable? supports_order?
alias validate_order supports_order?

def orderable?
supports?(:order)
end

def validate_order
supports?(:order)
end

def self.with_tenant(tenant_id)
tenant = Tenant.find(tenant_id)
Expand Down
6 changes: 3 additions & 3 deletions spec/models/service_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1142,19 +1142,19 @@
end
end

context "#supports_order?" do
context "#supports?(:order)" do
context 'when service_template cannot be displayed' do
it "returns the expected boolean value" do
st = FactoryBot.create(:service_template, :service_template_catalog => FactoryBot.create(:service_template_catalog), :display => false)
expect(st.supports_order?).to eql(false)
expect(st.supports?(:order)).to eql(false)
expect(st.unsupported_reason(:order)).to eq('Service template is not configured to be displayed')
end
end

context 'when service_template can be displayed' do
it "returns the expected boolean value" do
st = FactoryBot.create(:service_template, :service_template_catalog => FactoryBot.create(:service_template_catalog), :display => true)
expect(st.supports_order?).to eql(true)
expect(st.supports?(:order)).to eql(true)
end
end
end
Expand Down

0 comments on commit 754d3e4

Please # to comment.