Skip to content

Instantly share code, notes, and snippets.

@dcarley
Created May 15, 2014 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcarley/a9b8d03ce6a8a29727d3 to your computer and use it in GitHub Desktop.
Save dcarley/a9b8d03ce6a8a29727d3 to your computer and use it in GitHub Desktop.
diff --git a/spec/vcloud/launcher/vm_orchestrator_spec.rb b/spec/vcloud/launcher/vm_orchestrator_spec.rb
index 496a2c0..48c3e32 100644
--- a/spec/vcloud/launcher/vm_orchestrator_spec.rb
+++ b/spec/vcloud/launcher/vm_orchestrator_spec.rb
@@ -6,6 +6,16 @@ describe Vcloud::Launcher::VmOrchestrator do
@vm_id = "vm-12345678-1234-1234-1234-123456712312"
end
+ let(:fog_vm) {
+ { :href => "/#{@vm_id}" }
+ }
+ let(:vapp) {
+ double(:vapp, :name => 'web-app1')
+ }
+ subject {
+ Vcloud::Launcher::VmOrchestrator.new(fog_vm, vapp)
+ }
+
it "orchestrate customization" do
vm_config = {
:hardware_config => {
@@ -34,8 +44,6 @@ describe Vcloud::Launcher::VmOrchestrator do
:href => 'https://vcloud.example.net/api/vdcStorageProfile/000aea1e-a5e9-4dd1-a028-40db8c98d237'
}
}
- fog_vm = { :href => "/#{@vm_id}" }
- vapp = double(:vapp, :name => 'web-app1')
vm = double(:vm, :id => @vm_id, :vapp_name => 'web-app1', :vapp => vapp, :name => 'test-vm-1')
Vcloud::Core::Vm.should_receive(:new).with(@vm_id, vapp).and_return(vm)
@@ -48,12 +56,10 @@ describe Vcloud::Launcher::VmOrchestrator do
vm.should_receive(:update_metadata).with(vm_config[:metadata])
vm.should_receive(:configure_guest_customization_section).with('web-app1', vm_config[:bootstrap], vm_config[:extra_disks])
- Vcloud::Launcher::VmOrchestrator.new(fog_vm, vapp).customize(vm_config)
+ subject.customize(vm_config)
end
it "if a storage_profile is not specified, customize continues with other customizations" do
- fog_vm = { :href => "/#{@vm_id}" }
- vapp = double(:vapp, :name => 'web-app1')
vm = double(:vm, :id => @vm_id, :vapp_name => 'web-app1', :vapp => vapp, :name => 'test-vm-1')
vm_config = {
:metadata => {:shutdown => true},
@@ -70,7 +76,7 @@ describe Vcloud::Launcher::VmOrchestrator do
vm.should_receive(:configure_network_interfaces).with(vm_config[:network_connections])
vm.should_receive(:configure_guest_customization_section).with('web-app1', vm_config[:bootstrap], vm_config[:extra_disks])
- Vcloud::Launcher::VmOrchestrator.new(fog_vm, vapp).customize(vm_config)
+ subject.customize(vm_config)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment