From e7db10bf18d002bdb3c1f6975b223cc9e4fcc67f Mon Sep 17 00:00:00 2001 From: d-m-u Date: Thu, 17 Jan 2019 11:37:27 -0500 Subject: [PATCH] Fix rubocop issues --- app/models/service_orchestration.rb | 11 +++++++---- spec/models/service_orchestration_spec.rb | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/models/service_orchestration.rb b/app/models/service_orchestration.rb index beecdecabb7..8b838a1727a 100644 --- a/app/models/service_orchestration.rb +++ b/app/models/service_orchestration.rb @@ -28,7 +28,8 @@ def orchestration_stack_status def deploy_orchestration_stack creation_options = stack_options @orchestration_stack = ManageIQ::Providers::CloudManager::OrchestrationStack.create_stack( - orchestration_manager, stack_name, orchestration_template, creation_options) + orchestration_manager, stack_name, orchestration_template, creation_options + ) ensure # create options may never be saved before unless they were overridden save_create_options @@ -145,9 +146,11 @@ def pick_orchestration_template(dialog_options) end def save_create_options - stack_attributes = @orchestration_stack ? - @orchestration_stack.attributes.compact : - {:name => stack_name} + stack_attributes = if @orchestration_stack + @orchestration_stack.attributes.compact + else + {:name => stack_name} + end stack_attributes.delete('id') options.merge!(:orchestration_stack => stack_attributes, :create_options => dup_and_process_password(stack_options)) diff --git a/spec/models/service_orchestration_spec.rb b/spec/models/service_orchestration_spec.rb index abc6f4ba714..538a4bf9445 100644 --- a/spec/models/service_orchestration_spec.rb +++ b/spec/models/service_orchestration_spec.rb @@ -9,8 +9,8 @@ let(:service_template) do FactoryBot.create(:service_template_orchestration, - :orchestration_manager => manager_in_st, - :orchestration_template => template_in_st) + :orchestration_manager => manager_in_st, + :orchestration_template => template_in_st) end let(:dialog_options) do @@ -27,11 +27,11 @@ let(:service) do FactoryBot.create(:service_orchestration, - :service_template => service_template, - :orchestration_manager => manager_in_st, - :orchestration_template => template_in_st, - :evm_owner => FactoryBot.create(:user), - :miq_group => FactoryBot.create(:miq_group)) + :service_template => service_template, + :orchestration_manager => manager_in_st, + :orchestration_template => template_in_st, + :evm_owner => FactoryBot.create(:user), + :miq_group => FactoryBot.create(:miq_group)) end let(:service_with_dialog_options) do @@ -98,7 +98,8 @@ describe "#stack_options" do before do allow_any_instance_of(ManageIQ::Providers::Amazon::CloudManager::OrchestrationServiceOptionConverter).to( - receive(:stack_create_options).and_return(dialog_options)) + receive(:stack_create_options).and_return(dialog_options) + ) end it "gets stack options set by dialog" do @@ -266,8 +267,8 @@ describe '#post_provision_configure' do before do - allow(ManageIQ::Providers::Amazon::CloudManager::OrchestrationStack).to receive( - :raw_create_stack).and_return("ems_ref") + allow(ManageIQ::Providers::Amazon::CloudManager::OrchestrationStack) + .to receive(:raw_create_stack).and_return("ems_ref") @resulting_stack = service.deploy_orchestration_stack service.miq_request_task = FactoryBot.create(:service_template_provision_task)