-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11075 from gauravaradhye/refactoring
Replaced validate_reboot_guest by supports_reboot_guest
- Loading branch information
Showing
13 changed files
with
77 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/models/manageiq/providers/google/cloud_manager/vm/operations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
app/models/manageiq/providers/google/cloud_manager/vm/operations/guest.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/models/manageiq/providers/openstack/cloud_manager/vm/operations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
app/models/manageiq/providers/openstack/cloud_manager/vm/operations/guest.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/models/manageiq/providers/vmware/infra_manager/vm/operations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module ManageIQ::Providers::Vmware::InfraManager::Vm::Operations | ||
extend ActiveSupport::Concern | ||
|
||
include_concern 'Guest' | ||
end |
19 changes: 12 additions & 7 deletions
19
app/models/manageiq/providers/vmware/infra_manager/vm/operations/guest.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 27 additions & 6 deletions
33
spec/support/examples_group/shared_examples_for_vm_or_template_is_available.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,51 @@ | ||
shared_examples_for "Vm operation is available when not powered on" do | ||
it "when powered on" do | ||
vm.update_attributes(:raw_power_state => power_state_on) | ||
expect(vm.is_available?(state)).to be_falsey | ||
if vm.respond_to?("supports_#{state}?") | ||
expect(vm.public_send("supports_#{state}?")).to be_falsey | ||
else | ||
expect(vm.is_available?(state)).to be_falsey | ||
end | ||
end | ||
|
||
it "when not powered on" do | ||
vm.update_attributes(:raw_power_state => power_state_suspended) | ||
expect(vm.is_available?(state)).to be_truthy | ||
if vm.respond_to?("supports_#{state}?") | ||
expect(vm.public_send("supports_#{state}?")).to be_truthy | ||
else | ||
expect(vm.is_available?(state)).to be_truthy | ||
end | ||
end | ||
end | ||
|
||
shared_examples_for "Vm operation is available when powered on" do | ||
it "when powered on" do | ||
vm.update_attributes(:raw_power_state => power_state_on) | ||
expect(vm.is_available?(state)).to be_truthy | ||
if vm.respond_to?("supports_#{state}?") | ||
expect(vm.public_send("supports_#{state}?")).to be_truthy | ||
else | ||
expect(vm.is_available?(state)).to be_truthy | ||
end | ||
end | ||
|
||
it "when not powered on" do | ||
vm.update_attributes(:raw_power_state => power_state_suspended) | ||
expect(vm.is_available?(state)).to be_falsey | ||
if vm.respond_to?("supports_#{state}?") | ||
expect(vm.public_send("supports_#{state}?")).to be_falsey | ||
else | ||
expect(vm.is_available?(state)).to be_falsey | ||
end | ||
end | ||
end | ||
|
||
shared_examples_for "Vm operation is not available" do | ||
it "is not available" do | ||
expect(vm.is_available?(state)).to be_falsey | ||
expect(vm.is_available_now_error_message(state)).to include("not available") | ||
if vm.respond_to?("supports_#{state}?") | ||
expect(vm.public_send("supports_#{state}?")).to be_falsey | ||
expect(vm.unsupported_reason(state.to_sym)).to include("not available") | ||
else | ||
expect(vm.is_available?(state)).to be_falsey | ||
expect(vm.is_available_now_error_message(state)).to include("not available") | ||
end | ||
end | ||
end |