Skip to content

Commit

Permalink
Add check provider_region is not set to nil for non-Google provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ZitaNemeckova committed Apr 6, 2018
1 parent 0eabec0 commit aa80005
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ExtManagementSystem < ActiveRecord::Base
def up
say_with_time("Removing provider_region from ManageIQ::Providers::Google::CloudManager") do
ExtManagementSystem.where(:type => 'ManageIQ::Providers::Google::CloudManager').each do |provider|
provider.update_attributes!(:provider_region => nil)
provider.update_attributes!(:provider_region => nil)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@
:provider_region => 42)
ems_stub.create!(:type => 'ManageIQ::Providers::Amazon::CloudManager',
:provider_region => 42)
ems_stub.create!(:type => 'ManageIQ::Providers::Azure::CloudManager',
:provider_region => 42)
ems_stub.create!(:type => 'ManageIQ::Providers::Openstack::CloudManager',
:provider_region => 42)
ems_stub.create!(:type => 'ManageIQ::Providers::Vmware::CloudManager',
:provider_region => 42)

migrate
end

it 'sets provider_region to nil for ManageIQ::Providers::Google::CloudManager' do
expect(ems_stub.where(:provider_region => nil).count).to eq 1
end

it 'does not set provider_region to nil for other providers' do
expect(ems_stub.where(:provider_region => 42).count).to eq 4
end
end
end

0 comments on commit aa80005

Please sign in to comment.