Skip to content

Commit

Permalink
[catalog_controller_spec.rb] Fix ems let... again
Browse files Browse the repository at this point in the history
This is a follow up to 02e4b85 as the solution provided there, while
works for this use case, ended up causing problems in
`ManageIQ/manageiq-content`:

ManageIQ/manageiq#20787 (comment)

Instead, we use the :provider_embedded_ansible factory, and reference
the `.automation_manager` from that.  In addition, since a update to the
`:inventory_root_groups` was needed, we also modify the record in a
`before` statement as well.

This ends up not being as clean as the previous implementation, but
makes sure we are using the `EmbeddedAnsible` provider in the form that
it would be called when used in the application.
  • Loading branch information
NickLaMuro committed Nov 13, 2020
1 parent 6be5b9a commit f3fadd9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions spec/controllers/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,8 @@
let(:auth) { FactoryBot.create(:authentication, :manager_ref => 6, :type => "ManageIQ::Providers::EmbeddedAnsible::AutomationManager::MachineCredential") }
let(:repository) { FactoryBot.create(:configuration_script_source, :manager => ems, :type => "ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource") }
let(:inventory_root_group) { FactoryBot.create(:inventory_root_group) }
let(:ems) do
FactoryBot.create(:embedded_automation_manager_ansible, :inventory_root_groups => [inventory_root_group])
end
let(:provider) { FactoryBot.create(:provider_embedded_ansible) }
let(:ems) { provider.automation_manager }
let(:dialog) { FactoryBot.create(:dialog) }
let(:playbook) do
FactoryBot.create(:embedded_playbook,
Expand All @@ -744,6 +743,10 @@
:inventory_root_group => inventory_root_group)
end

before do
ems.update_attributes(:inventory_root_groups => [inventory_root_group])
end

it "returns playbook service template details for provision & retirement tabs for summary screen" do
options = {
:name => 'test_ansible_catalog_item',
Expand Down

0 comments on commit f3fadd9

Please sign in to comment.