Skip to content

Commit

Permalink
testing MiqServer#miq_region should return correct region
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Jun 22, 2020
1 parent 9b9da40 commit e82b446
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/models/miq_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,23 @@
end
end

describe "#miq_region" do
before do
Zone.seed
@region1 = MiqRegion.first.region
@region2 = FactoryBot.create(:miq_region, :id => MiqRegion.id_in_region(1, @region1 + 1)).region
zone = FactoryBot.create(:zone, :id => Zone.id_in_region(2, @region2))

@server1 = FactoryBot.create(:miq_server)
@server2 = FactoryBot.create(:miq_server, :zone => zone, :id => MiqServer.id_in_region(1, @region2))
end

it "returns region this server belongs to" do
expect(@server1.miq_region.region).to eq(@region1)
expect(@server2.miq_region.region).to eq(@region2)
end
end

describe ".zone_is_modifiable?" do
it "is true when there are multiple zones in the region" do
FactoryBot.create(:miq_server)
Expand Down

0 comments on commit e82b446

Please sign in to comment.