virtual_box 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -119,14 +119,8 @@ class Vm
119
119
  #
120
120
  # @return [VirtualBox::Vm] self, for easy call chaining
121
121
  def register
122
- unregister if registered?
123
-
124
- result = VirtualBox.run_command ['VBoxManage', 'createvm',
125
- '--name', name, '--uuid', uid, '--register']
126
- if result.status != 0
127
- raise 'Unexpected error code returned by VirtualBox'
128
- end
129
-
122
+ VirtualBox.run_command! ['VBoxManage', 'createvm', '--name', name,
123
+ '--uuid', uid, '--register']
130
124
  begin
131
125
  push_config
132
126
  rescue
@@ -151,11 +145,8 @@ class Vm
151
145
  def start
152
146
  register unless registered?
153
147
 
154
- result = VirtualBox.run_command ['VBoxManage', '--nologo', 'startvm', uid,
155
- '--type', gui ? 'gui' : 'headless']
156
- if result.status != 0
157
- raise 'Unexpected error code returned by VirtualBox'
158
- end
148
+ VirtualBox.run_command! ['VBoxManage', '--nologo', 'startvm', uid,
149
+ '--type', gui ? 'gui' : 'headless']
159
150
  self
160
151
  end
161
152
 
@@ -185,11 +176,8 @@ class Vm
185
176
  'injectnmi'
186
177
  end
187
178
 
188
- result = VirtualBox.run_command ['VBoxManage', '--nologo', 'controlvm', uid,
189
- action]
190
- if result.status != 0
191
- raise 'Unexpected error code returned by VirtualBox'
192
- end
179
+ VirtualBox.run_command! ['VBoxManage', '--nologo', 'controlvm', uid,
180
+ action]
193
181
  self
194
182
  end
195
183
 
@@ -197,11 +185,8 @@ class Vm
197
185
  #
198
186
  # @return [Array<String>] UUIDs for VMs that VirtualBox is aware of
199
187
  def self.registered_uids
200
- result = VirtualBox.run_command ['VBoxManage', '--nologo', 'list', 'vms']
201
- if result.status != 0
202
- raise 'Unexpected error code returned by VirtualBox'
203
- end
204
- result.output.split("\n").map do |id_info|
188
+ output = VirtualBox.run_command! ['VBoxManage', '--nologo', 'list', 'vms']
189
+ output.split("\n").map do |id_info|
205
190
  uid_offset = id_info.rindex(?{) + 1
206
191
  uid = id_info[uid_offset...-1] # Exclude the closing }
207
192
  end
@@ -211,12 +196,9 @@ class Vm
211
196
  #
212
197
  # @return [Array<String>] UUIDs for VMs that are running in VirtualBox
213
198
  def self.started_uids
214
- result = VirtualBox.run_command ['VBoxManage', '--nologo', 'list',
215
- 'runningvms']
216
- if result.status != 0
217
- raise 'Unexpected error code returned by VirtualBox'
218
- end
219
- result.output.split("\n").map do |id_info|
199
+ output = VirtualBox.run_command! ['VBoxManage', '--nologo', 'list',
200
+ 'runningvms']
201
+ output.split("\n").map do |id_info|
220
202
  uid_offset = id_info.rindex(?{) + 1
221
203
  uid = id_info[uid_offset...-1] # Exclude the closing }
222
204
  end
@@ -235,9 +217,7 @@ class Vm
235
217
  command.concat nic.to_params(index + 1)
236
218
  end
237
219
  end
238
- if VirtualBox.run_command(command).status != 0
239
- raise 'Unexpected error code returned by VirtualBox'
240
- end
220
+ VirtualBox.run_command! command
241
221
 
242
222
  io_buses.each { |bus| bus.add_to self }
243
223
 
@@ -248,13 +228,9 @@ class Vm
248
228
  #
249
229
  # @return [VirtualBox::Vm] self, for easy call chaining
250
230
  def pull_config
251
- result = VirtualBox.run_command ['VBoxManage', '--nologo', 'showvminfo',
252
- '--machinereadable', uid]
253
- if result.status != 0
254
- raise 'Unexpected error code returned by VirtualBox'
255
- end
256
-
257
- config = self.class.parse_machine_readable result.output
231
+ output = VirtualBox.run_command! ['VBoxManage', '--nologo', 'showvminfo',
232
+ '--machinereadable', uid]
233
+ config = self.class.parse_machine_readable output
258
234
 
259
235
  self.name = config['name']
260
236
  self.uid = config['UUID']
data/lib/virtual_box.rb CHANGED
@@ -3,10 +3,11 @@ module VirtualBox
3
3
 
4
4
  end
5
5
 
6
- require 'hashie/mash'
6
+ require 'posix/spawn'
7
7
  require 'uuid'
8
8
 
9
9
  require 'virtual_box/cli.rb'
10
+ require 'virtual_box/error.rb'
10
11
  require 'virtual_box/version.rb'
11
12
 
12
13
  require 'virtual_box/vm.rb'
@@ -15,5 +16,5 @@ require 'virtual_box/vm/disk.rb'
15
16
  require 'virtual_box/vm/io_bus.rb'
16
17
  require 'virtual_box/vm/nic.rb'
17
18
 
18
- require 'virtual_box/dhcp.rb'
19
19
  require 'virtual_box/net.rb'
20
+ require 'virtual_box/net/dhcp.rb'
@@ -7,12 +7,12 @@ describe 'CLI' do
7
7
  @result = VirtualBox.run_command(['echo', 'Hello'])
8
8
  end
9
9
 
10
- it 'should report successful completion' do
11
- @result.status.must_equal 0
10
+ it 'reports successful completion' do
11
+ @result[:status].must_equal 0
12
12
  end
13
13
 
14
- it 'should return echo output' do
15
- @result.output.must_equal "Hello\n"
14
+ it 'returns echo output' do
15
+ @result[:output].must_equal "Hello\n"
16
16
  end
17
17
  end
18
18
 
@@ -21,12 +21,32 @@ describe 'CLI' do
21
21
  @result = VirtualBox.run_command(['ruby', '-e', 'print "Hi"; exit 1'])
22
22
  end
23
23
 
24
- it 'should return echo output' do
25
- @result.output.must_equal 'Hi'
24
+ it 'returns echo output' do
25
+ @result[:output].must_equal 'Hi'
26
26
  end
27
27
 
28
- it 'should report exit code 1' do
29
- @result.status.must_equal 1
28
+ it 'reports exit code 1' do
29
+ @result[:status].must_equal 1
30
+ end
31
+ end
32
+ end
33
+
34
+ describe 'run_command!' do
35
+ describe 'with hello world echo' do
36
+ before do
37
+ @output = VirtualBox.run_command!(['echo', 'Hello'])
38
+ end
39
+
40
+ it 'returns echo output' do
41
+ @output.must_equal "Hello\n"
42
+ end
43
+ end
44
+
45
+ describe 'with inline ruby script' do
46
+ it 'raises VirtualBox::Error' do
47
+ lambda {
48
+ VirtualBox.run_command! ['ruby', '-e', 'print "Hi"; exit 1']
49
+ }.must_raise VirtualBox::Error
30
50
  end
31
51
  end
32
52
  end
@@ -6,9 +6,9 @@ describe 'VirtualBox' do
6
6
  before do
7
7
  iso_file = 'test/fixtures/tinycore/remix.iso'
8
8
  @net = VirtualBox::Net.new(:ip => '192.168.66.6',
9
- :netmask => '255.255.255.0').add
10
- @dhcp = VirtualBox::Dhcp.new(:net_name => @net.name,
11
- :start_ip => '192.168.66.66').add
9
+ :netmask => '255.255.255.0',
10
+ :dhcp => { :start_ip => '192.168.66.66' }).add
11
+
12
12
  @vm = VirtualBox::Vm.new(
13
13
  :board => { :ram => 256, :cpus => 1, :video_ram => 16,
14
14
  :os => :linux26 },
@@ -20,7 +20,6 @@ describe 'VirtualBox' do
20
20
 
21
21
  after do
22
22
  @vm.unregister unless @vm.nil?
23
- @dhcp.remove unless @dhcp.nil?
24
23
  @net.remove unless @net.nil?
25
24
  end
26
25
 
@@ -39,7 +38,7 @@ describe 'VirtualBox' do
39
38
  end
40
39
  end
41
40
 
42
- it 'should respond to a SSH connection' do
41
+ it 'responds to a SSH connection' do
43
42
  output = nil
44
43
  Net::SSH.start '192.168.66.66', 'tc', :timeout => 15,
45
44
  :global_known_hosts_file => [], :user_known_hosts_file => [],
@@ -1,9 +1,9 @@
1
- require File.expand_path('../helper.rb', File.dirname(__FILE__))
1
+ require File.expand_path('../../helper.rb', File.dirname(__FILE__))
2
2
 
3
- describe VirtualBox::Dhcp do
3
+ describe VirtualBox::Net::Dhcp do
4
4
  describe 'ip 192.168.0.1' do
5
5
  before do
6
- @dhcp = VirtualBox::Dhcp.new :ip => '192.168.0.1'
6
+ @dhcp = VirtualBox::Net::Dhcp.new :ip => '192.168.0.1'
7
7
  end
8
8
  it 'has a default netmask' do
9
9
  @dhcp.netmask.must_equal '255.255.255.0'
@@ -18,7 +18,7 @@ describe VirtualBox::Dhcp do
18
18
 
19
19
  describe 'startip 192.168.0.64' do
20
20
  before do
21
- @dhcp = VirtualBox::Dhcp.new :start_ip => '192.168.0.64'
21
+ @dhcp = VirtualBox::Net::Dhcp.new :start_ip => '192.168.0.64'
22
22
  end
23
23
  it 'computes the server IP' do
24
24
  @dhcp.ip.must_equal '192.168.0.1'
@@ -26,26 +26,19 @@ describe VirtualBox::Dhcp do
26
26
  end
27
27
 
28
28
  describe 'random rule' do
29
+ let(:net_name) { 'rbxvbox0' }
30
+
29
31
  before do
30
- @dhcp = VirtualBox::Dhcp.new :net_name => 'rbxvbox0', :ip => '10.1.0.1'
31
- end
32
-
33
- it 'is not live' do
34
- @dhcp.wont_be :live?
32
+ @dhcp = VirtualBox::Net::Dhcp.new :ip => '10.1.0.1'
35
33
  end
36
34
 
37
35
  describe 'after being added' do
38
- before { @dhcp.add }
39
- after { @dhcp.remove }
40
-
41
- it 'is live' do
42
- @dhcp.must_be :live?
43
- end
36
+ before { @dhcp.add net_name }
37
+ after { @dhcp.remove net_name }
44
38
 
45
39
  it 'shows up on the list of live servers' do
46
- servers = VirtualBox::Dhcp.all
47
- dhcp = servers.find { |s| s.net_name == @dhcp.net_name }
48
- dhcp.to_hash.must_equal @dhcp.to_hash
40
+ dhcps = VirtualBox::Net::Dhcp.all
41
+ dhcps[net_name].to_hash.must_equal @dhcp.to_hash
49
42
  end
50
43
  end
51
44
  end
@@ -1,6 +1,30 @@
1
1
  require File.expand_path('../helper.rb', File.dirname(__FILE__))
2
2
 
3
3
  describe VirtualBox::Net do
4
+ describe 'host_nics' do
5
+ let(:nics) { VirtualBox::Net.host_nics }
6
+
7
+ it 'has at least 1 card' do
8
+ nics.length.must_be :>=, 1
9
+ end
10
+
11
+ describe 'first card' do
12
+ let(:card) { nics.first }
13
+
14
+ it 'has a device name' do
15
+ card[:name].wont_be_nil
16
+ end
17
+
18
+ it 'has a MAC' do
19
+ card[:mac].wont_be_nil
20
+ end
21
+
22
+ it 'has its device name show up in ifconfig' do
23
+ `ifconfig -a`.must_include card[:name]
24
+ end
25
+ end
26
+ end
27
+
4
28
  describe 'with no arguments' do
5
29
  before { @net = VirtualBox::Net.new }
6
30
 
@@ -26,7 +50,7 @@ describe VirtualBox::Net do
26
50
 
27
51
  it 'has an interface name that shows up in the ifconfig output' do
28
52
  @net.if_name.wont_be_nil
29
- `ifconfig`.must_include @net.if_name
53
+ `ifconfig -a`.must_include @net.if_name
30
54
  end
31
55
 
32
56
  it 'has a name' do
@@ -67,7 +91,41 @@ describe VirtualBox::Net do
67
91
 
68
92
  it 'has an interface name that shows up in the ifconfig output' do
69
93
  @net.if_name.wont_be_nil
70
- `ifconfig`.must_include @net.if_name
94
+ `ifconfig -a`.must_include @net.if_name
95
+ end
96
+
97
+ it 'shows up on the list of live networks' do
98
+ networks = VirtualBox::Net.all
99
+ network = networks.find { |n| n.if_name == @net.if_name }
100
+ network.to_hash.must_equal @net.to_hash
101
+ end
102
+ end
103
+ end
104
+
105
+ describe 'with a dhcp server' do
106
+ before do
107
+ @net = VirtualBox::Net.new :dhcp => { :start_ip => '192.168.166.166' }
108
+ end
109
+
110
+ it 'is not live' do
111
+ @net.wont_be :live?
112
+ end
113
+
114
+ it 'has a DHCP server' do
115
+ @net.dhcp.wont_be_nil
116
+ end
117
+
118
+ describe 'after adding to VirtualBox' do
119
+ before { @net.add }
120
+ after { @net.remove }
121
+
122
+ it 'is live' do
123
+ @net.must_be :live?
124
+ end
125
+
126
+ it 'has an interface name that shows up in the ifconfig output' do
127
+ @net.if_name.wont_be_nil
128
+ `ifconfig -a`.must_include @net.if_name
71
129
  end
72
130
 
73
131
  it 'shows up on the list of live networks' do
@@ -5,21 +5,21 @@ describe 'Version' do
5
5
  before do
6
6
  VirtualBox.reset_version_info!
7
7
  VirtualBox.expects(:run_command).once.
8
- returns(Hashie::Mash.new(:status => 0, :output => "3.0.4r50677\n"))
8
+ returns({ :status => 0, :output => "3.0.4r50677\n" })
9
9
  end
10
10
 
11
- it 'should report release' do
12
- VirtualBox.version.release.must_equal '3.0.4'
11
+ it 'reports release' do
12
+ VirtualBox.version[:release].must_equal '3.0.4'
13
13
  end
14
- it 'should report revision' do
15
- VirtualBox.version.svn.must_equal 50677
14
+ it 'reports revision' do
15
+ VirtualBox.version[:svn].must_equal 50677
16
16
  end
17
- it 'should report personal edition' do
17
+ it 'reports personal edition' do
18
18
  VirtualBox.ose?.must_equal false
19
19
  end
20
- it 'should cache version info' do
21
- VirtualBox.version.release.must_equal '3.0.4'
22
- VirtualBox.version.svn.must_equal 50677
20
+ it 'caches version info' do
21
+ VirtualBox.version[:release].must_equal '3.0.4'
22
+ VirtualBox.version[:svn].must_equal 50677
23
23
  end
24
24
  end
25
25
 
@@ -27,16 +27,16 @@ describe 'Version' do
27
27
  before do
28
28
  VirtualBox.reset_version_info!
29
29
  VirtualBox.expects(:run_command).once.
30
- returns(Hashie::Mash.new(:status => 0, :output => "3.2.8_OSEr64453\n"))
30
+ returns({ :status => 0, :output => "3.2.8_OSEr64453\n" })
31
31
  end
32
32
 
33
- it 'should report release' do
34
- VirtualBox.version.release.must_equal '3.2.8'
33
+ it 'reports release' do
34
+ VirtualBox.version[:release].must_equal '3.2.8'
35
35
  end
36
- it 'should report revision' do
37
- VirtualBox.version.svn.must_equal 64453
36
+ it 'reports revision' do
37
+ VirtualBox.version[:svn].must_equal 64453
38
38
  end
39
- it 'should report open-source edition' do
39
+ it 'reports open-source edition' do
40
40
  VirtualBox.ose?.must_equal true
41
41
  end
42
42
  end
@@ -45,14 +45,14 @@ describe 'Version' do
45
45
  before do
46
46
  VirtualBox.reset_version_info!
47
47
  VirtualBox.expects(:run_command).once.
48
- returns(Hashie::Mash.new(:status => 127))
48
+ returns({:status => 127})
49
49
  end
50
50
 
51
- it 'should not report a release' do
52
- VirtualBox.version.release.must_equal nil
51
+ it 'does not report a release' do
52
+ VirtualBox.version[:release].must_equal nil
53
53
  end
54
54
 
55
- it 'should raise an exception on ose' do
55
+ it 'raises an exception on ose' do
56
56
  lambda {
57
57
  VirtualBox.ose?
58
58
  }.must_raise(RuntimeError)
@@ -64,8 +64,8 @@ describe 'Version' do
64
64
  VirtualBox.reset_version_info!
65
65
  end
66
66
 
67
- it 'should report some version' do
68
- VirtualBox.version.release.wont_be :empty?
67
+ it 'reports some version' do
68
+ VirtualBox.version[:release].wont_be :empty?
69
69
  end
70
70
  end
71
71
  end
@@ -5,16 +5,16 @@ describe VirtualBox::Vm::Board do
5
5
  before do
6
6
  @types = VirtualBox::Vm::Board.os_types
7
7
  end
8
- it 'should map linux 2.6' do
8
+ it 'maps linux 2.6' do
9
9
  @types.must_include :linux26
10
10
  end
11
11
 
12
- it 'should include linux 2.6 ID' do
12
+ it 'includes linux 2.6 ID' do
13
13
  @types.must_include 'linux26'
14
14
  @types.must_include 'Linux26'
15
15
  end
16
16
 
17
- it 'should include linux 2.6 description' do
17
+ it 'includes linux 2.6 description' do
18
18
  @types.must_include 'Linux 2.6'
19
19
  end
20
20
  end
@@ -29,7 +29,7 @@ describe VirtualBox::Vm::Board do
29
29
  @vm.unregister
30
30
  end
31
31
 
32
- it 'should push/pull specification correctly' do
32
+ it 'pushes/pulls specification correctly' do
33
33
  vm = VirtualBox::Vm.new :uid => @vm.uid
34
34
 
35
35
  vm.pull_config
@@ -6,11 +6,11 @@ describe VirtualBox::Vm::Disk do
6
6
  @disk = VirtualBox::Vm::Disk.new :file => 'disk.iso'
7
7
  end
8
8
 
9
- it 'should guess media type' do
9
+ it 'guesses media type' do
10
10
  @disk.media.must_equal :dvd
11
11
  end
12
12
 
13
- it 'should guess image type' do
13
+ it 'guesses image type' do
14
14
  @disk.format.must_equal :raw
15
15
  end
16
16
  end
@@ -29,19 +29,19 @@ describe VirtualBox::Vm::Disk do
29
29
  File.unlink vmdk_path if File.exist?(vmdk_path)
30
30
  end
31
31
 
32
- it 'should create a small file' do
32
+ it 'creates a small file' do
33
33
  File.stat(vmdk_path).size.must_be :<, 256 * 1024
34
34
  end
35
35
 
36
- it 'should return a Disk pointing to the file' do
36
+ it 'returns a Disk pointing to the file' do
37
37
  @disk.file.must_equal vmdk_path
38
38
  end
39
39
 
40
- it 'should return a HDD Disk' do
40
+ it 'returns a HDD Disk' do
41
41
  @disk.media.must_equal :disk
42
42
  end
43
43
 
44
- it 'should return a VMDK Disk' do
44
+ it 'returns a VMDK Disk' do
45
45
  @disk.format.must_equal :vmdk
46
46
  end
47
47
  end
@@ -59,19 +59,19 @@ describe VirtualBox::Vm::Disk do
59
59
  File.unlink vdi_path if File.exist?(vdi_path)
60
60
  end
61
61
 
62
- it 'should create a 16-megabyte file' do
62
+ it 'creates a 16-megabyte file' do
63
63
  (File.stat(vdi_path).size / (1024 * 1024)).must_equal 16
64
64
  end
65
65
 
66
- it 'should return a Disk pointing to the file' do
66
+ it 'returns a Disk pointing to the file' do
67
67
  @disk.file.must_equal vdi_path
68
68
  end
69
69
 
70
- it 'should return a HDD Disk' do
70
+ it 'returns a HDD Disk' do
71
71
  @disk.media.must_equal :disk
72
72
  end
73
73
 
74
- it 'should return a VDI Disk' do
74
+ it 'returns a VDI Disk' do
75
75
  @disk.format.must_equal :vdi
76
76
  end
77
77
  end
@@ -106,7 +106,7 @@ describe VirtualBox::Vm::Disk do
106
106
  end
107
107
  end
108
108
 
109
- it 'should push/pull specs correctly' do
109
+ it 'pushes/pulls specs correctly' do
110
110
  vm = VirtualBox::Vm.new :uid => @vm.uid
111
111
  vm.pull_config
112
112
  vm.io_buses.map { |io_bus| io_bus.to_hash }.
@@ -2,34 +2,34 @@ require File.expand_path('../../helper.rb', File.dirname(__FILE__))
2
2
 
3
3
  describe VirtualBox::Vm::IoBus do
4
4
  describe 'IDE' do
5
- it 'should default to the PIIX4 chipset' do
5
+ it 'defaults to the PIIX4 chipset' do
6
6
  VirtualBox::Vm::IoBus.new(:bus => :ide).chip.must_equal :piix4
7
7
  end
8
8
 
9
- it 'should recognize the PIIX4 chipset' do
9
+ it 'recognizes the PIIX4 chipset' do
10
10
  VirtualBox::Vm::IoBus.new(:chip => :piix4).bus.must_equal :ide
11
11
  end
12
12
 
13
- it 'should be named IDE Controller by default' do
13
+ it 'ie named IDE Controller by default' do
14
14
  VirtualBox::Vm::IoBus.new(:bus => :ide).name.must_equal 'IDE Controller'
15
15
  end
16
16
  end
17
17
 
18
18
  describe 'SATA' do
19
- it 'should default to the AHCI chipset' do
19
+ it 'defaults to the AHCI chipset' do
20
20
  VirtualBox::Vm::IoBus.new(:bus => :sata).chip.must_equal :ahci
21
21
  end
22
22
 
23
- it 'should recognize the PIIX4 chipset' do
23
+ it 'recognizes the PIIX4 chipset' do
24
24
  VirtualBox::Vm::IoBus.new(:chip => :ahci).bus.must_equal :sata
25
25
  end
26
26
 
27
- it 'should be named SATA Controller by default' do
27
+ it 'is named SATA Controller by default' do
28
28
  VirtualBox::Vm::IoBus.new(:bus => :sata).name.must_equal 'SATA Controller'
29
29
  end
30
30
  end
31
31
 
32
- describe 'VM with all bunch of buses' do
32
+ describe 'VM with a bunch of IO controllers' do
33
33
  before do
34
34
  @vm = VirtualBox::Vm.new :io_buses => [
35
35
  { :bus => :ide, :name => 'Weird Name', :chip => :piix3 },
@@ -44,7 +44,7 @@ describe VirtualBox::Vm::IoBus do
44
44
  @vm.unregister
45
45
  end
46
46
 
47
- it 'should push/pull specs correctly' do
47
+ it 'pushes/pulls specs correctly' do
48
48
  vm = VirtualBox::Vm.new :uid => @vm.uid
49
49
  vm.pull_config
50
50
  vm.io_buses.map { |io_bus| io_bus.to_hash }.
@@ -1,31 +1,11 @@
1
1
  require File.expand_path('../../helper.rb', File.dirname(__FILE__))
2
2
 
3
3
  describe VirtualBox::Vm::Nic do
4
- describe 'host_nics' do
5
- let(:nics) { VirtualBox::Vm::Nic.host_nics }
6
-
7
- it 'should have at least 1 card' do
8
- nics.length.must_be :>=, 1
9
- end
10
-
11
- describe 'first card' do
12
- let(:card) { nics.first }
13
-
14
- it 'should have an interface ID' do
15
- card[:id].wont_be_nil
16
- end
17
-
18
- it 'should have a MAC' do
19
- card[:mac].wont_be_nil
20
- end
21
- end
22
- end
23
-
24
4
  describe 'NAT card and virtual card' do
25
5
  before do
26
6
  @vm = VirtualBox::Vm.new :nics => [
27
7
  { :mode => :bridged, :chip => :amd,
28
- :net_name => VirtualBox::Vm::Nic.host_nics.first[:id],
8
+ :net_name => VirtualBox::Net.host_nics.first[:name],
29
9
  :mac => 'aabbccddeeff' },
30
10
  { :port => 2, :mode => :virtual, :chip => :virtual,
31
11
  :net_name => 'rbx00' }
@@ -37,11 +17,11 @@ describe VirtualBox::Vm::Nic do
37
17
  @vm.unregister
38
18
  end
39
19
 
40
- it 'should skip NIC 1' do
20
+ it 'skips NIC 1' do
41
21
  @vm.nics[1].must_be_nil
42
22
  end
43
23
 
44
- it 'should push/pull specs correctly' do
24
+ it 'pushes/pulls specs correctly' do
45
25
  vm = VirtualBox::Vm.new :uid => @vm.uid
46
26
  vm.pull_config
47
27
  vm.to_hash[:nics].must_equal @vm.to_hash[:nics]
@@ -6,15 +6,15 @@ describe VirtualBox::Vm do
6
6
  @vm = VirtualBox::Vm.new
7
7
  end
8
8
 
9
- it 'should receive a name' do
9
+ it 'receives a name' do
10
10
  @vm.name.wont_be_nil
11
11
  end
12
12
 
13
- it 'should receive an UID' do
13
+ it 'receives an UID' do
14
14
  @vm.uid.wont_be_nil
15
15
  end
16
16
 
17
- it 'should be unregistered' do
17
+ it 'is unregistered' do
18
18
  @vm.wont_be :registered?
19
19
  end
20
20
 
@@ -27,11 +27,11 @@ describe VirtualBox::Vm do
27
27
  @vm.unregister
28
28
  end
29
29
 
30
- it 'should know it is registered' do
30
+ it 'knows it is registered' do
31
31
  @vm.must_be :registered?
32
32
  end
33
33
 
34
- it 'should show up on the list of registered VM UIDs' do
34
+ it 'shows up on the list of registered VM UIDs' do
35
35
  uids = VirtualBox::Vm.registered_uids
36
36
  uids.must_include @vm.uid
37
37
  end
@@ -45,7 +45,7 @@ describe VirtualBox::Vm do
45
45
  sleep 0.5 # VirtualBox will barf if we unregister the VM right away.
46
46
  end
47
47
 
48
- it 'should show up on the list of started VM UIDs' do
48
+ it 'shows up on the list of started VM UIDs' do
49
49
  uids = VirtualBox::Vm.started_uids
50
50
  uids.must_include @vm.uid
51
51
  end