diff --git a/app/models/service.rb b/app/models/service.rb index da28817eee5..77281faede3 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -339,6 +339,7 @@ def reconfigure_resource_action end def reconfigure_dialog + return nil unless supports_reconfigure? resource_action = reconfigure_resource_action options = {:target => self, :reconfigure => true} diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index c0bfc60e759..9cd8cd5d96e 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -895,19 +895,20 @@ def create_deep_tree let(:service) { described_class.new(:options => {:dialog => "dialog_options"}) } let(:dialog_serializer) { instance_double("DialogSerializer") } let(:workflow) { instance_double("ResourceActionWorkflow", :dialog => "workflow_dialog") } + let(:ra) { FactoryBot.create(:resource_action, :dialog_id => 58, :ae_namespace => "foo", :ae_class => "bar", :ae_instance => "baz", :ae_attributes => {:service_action=>"reconfigure"}) } before do allow(DialogSerializer).to receive(:new).and_return(dialog_serializer) allow(dialog_serializer).to receive(:serialize).and_return("serialized_reconfigure_dialog") allow(ResourceActionWorkflow).to receive(:new).and_return(workflow) - allow(service).to receive(:reconfigure_resource_action).and_return("reconfigure_resource_action") + allow(service).to receive(:reconfigure_resource_action).and_return(ra) end it "creates a new resource action workflow" do expect(ResourceActionWorkflow).to receive(:new).with( "dialog_options", User.current_user, - "reconfigure_resource_action", + ra, :target => service, :reconfigure => true ) service.reconfigure_dialog