Skip to content

Commit

Permalink
Merge pull request #1267 from agrare/fix_cloud_networks_a_collection_…
Browse files Browse the repository at this point in the history
…including

Fix CloudNetworks spec with empty including()
  • Loading branch information
jrafanie committed Aug 30, 2024
2 parents b6c900d + 70f880c commit 4e4e1a0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spec/requests/cloud_networks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,21 @@

it 'successfully returns providers on query when providers do not have cloud_networks attribute' do
FactoryBot.create(:ems_container) # Openshift container manager does not respond to #cloud_networks
FactoryBot.create(:ems_cloud).tap { |x| 2.times { x.cloud_networks << FactoryBot.create(:cloud_network) } } # Provider with cloud networks
api_basic_authorize collection_action_identifier(:providers, :read, :get)

ems_cloud = FactoryBot.create(:ems_cloud) # Provider with cloud networks
cloud_network_1 = FactoryBot.create(:cloud_network, :ext_management_system => ems_cloud.network_manager)
cloud_network_2 = FactoryBot.create(:cloud_network, :ext_management_system => ems_cloud.network_manager)
api_basic_authorize collection_action_identifier(:providers, :read, :get)
get api_providers_url, :params => { :expand => 'resources,cloud_networks' }

expected = {
'resources' => a_collection_including(
a_hash_including(
'type' => 'ManageIQ::Providers::Amazon::CloudManager',
'cloud_networks' => a_collection_including
'cloud_networks' => a_collection_including(
a_hash_including('id' => cloud_network_1.id.to_s),
a_hash_including('id' => cloud_network_2.id.to_s)
)
),
a_hash_including(
'type' => 'ManageIQ::Providers::Openshift::ContainerManager'
Expand Down

0 comments on commit 4e4e1a0

Please sign in to comment.