vagrant 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. data/Gemfile +4 -4
  2. data/Rakefile +3 -3
  3. data/VERSION +1 -1
  4. data/bin/vagrant +5 -13
  5. data/config/default.rb +1 -0
  6. data/keys/README.md +8 -1
  7. data/keys/vagrant.ppk +26 -0
  8. data/lib/vagrant.rb +3 -3
  9. data/lib/vagrant/actions/base.rb +15 -4
  10. data/lib/vagrant/actions/box/add.rb +1 -1
  11. data/lib/vagrant/actions/box/download.rb +72 -66
  12. data/lib/vagrant/actions/box/unpackage.rb +1 -4
  13. data/lib/vagrant/actions/runner.rb +1 -1
  14. data/lib/vagrant/actions/vm/boot.rb +5 -7
  15. data/lib/vagrant/actions/vm/customize.rb +2 -2
  16. data/lib/vagrant/actions/vm/destroy.rb +2 -2
  17. data/lib/vagrant/actions/vm/down.rb +7 -0
  18. data/lib/vagrant/actions/vm/export.rb +10 -4
  19. data/lib/vagrant/actions/vm/forward_ports.rb +5 -15
  20. data/lib/vagrant/actions/vm/halt.rb +5 -3
  21. data/lib/vagrant/actions/vm/import.rb +10 -3
  22. data/lib/vagrant/actions/vm/move_hard_drive.rb +1 -3
  23. data/lib/vagrant/actions/vm/package.rb +33 -10
  24. data/lib/vagrant/actions/vm/provision.rb +4 -4
  25. data/lib/vagrant/actions/vm/reload.rb +1 -1
  26. data/lib/vagrant/actions/vm/resume.rb +1 -1
  27. data/lib/vagrant/actions/vm/shared_folders.rb +7 -7
  28. data/lib/vagrant/actions/vm/start.rb +3 -2
  29. data/lib/vagrant/actions/vm/suspend.rb +2 -2
  30. data/lib/vagrant/actions/vm/up.rb +7 -17
  31. data/lib/vagrant/active_list.rb +52 -45
  32. data/lib/vagrant/box.rb +18 -11
  33. data/lib/vagrant/busy.rb +7 -0
  34. data/lib/vagrant/command.rb +27 -0
  35. data/lib/vagrant/commands/base.rb +163 -0
  36. data/lib/vagrant/commands/box.rb +16 -0
  37. data/lib/vagrant/commands/box/add.rb +24 -0
  38. data/lib/vagrant/commands/box/list.rb +30 -0
  39. data/lib/vagrant/commands/box/remove.rb +31 -0
  40. data/lib/vagrant/commands/destroy.rb +23 -0
  41. data/lib/vagrant/commands/down.rb +16 -0
  42. data/lib/vagrant/commands/halt.rb +23 -0
  43. data/lib/vagrant/commands/init.rb +32 -0
  44. data/lib/vagrant/commands/package.rb +46 -0
  45. data/lib/vagrant/commands/reload.rb +22 -0
  46. data/lib/vagrant/commands/resume.rb +22 -0
  47. data/lib/vagrant/commands/ssh.rb +22 -0
  48. data/lib/vagrant/commands/ssh_config.rb +30 -0
  49. data/lib/vagrant/commands/status.rb +58 -0
  50. data/lib/vagrant/commands/suspend.rb +23 -0
  51. data/lib/vagrant/commands/up.rb +26 -0
  52. data/lib/vagrant/config.rb +21 -11
  53. data/lib/vagrant/downloaders/file.rb +5 -5
  54. data/lib/vagrant/downloaders/http.rb +10 -15
  55. data/lib/vagrant/environment.rb +259 -0
  56. data/lib/vagrant/provisioners/base.rb +7 -0
  57. data/lib/vagrant/provisioners/chef.rb +24 -9
  58. data/lib/vagrant/provisioners/chef_server.rb +23 -48
  59. data/lib/vagrant/provisioners/chef_solo.rb +48 -22
  60. data/lib/vagrant/ssh.rb +95 -46
  61. data/lib/vagrant/util.rb +2 -2
  62. data/lib/vagrant/util/errors.rb +36 -0
  63. data/lib/vagrant/util/platform.rb +12 -0
  64. data/lib/vagrant/util/progress_meter.rb +33 -0
  65. data/lib/vagrant/util/stacked_proc_runner.rb +35 -0
  66. data/lib/vagrant/util/template_renderer.rb +83 -0
  67. data/lib/vagrant/vm.rb +1 -0
  68. data/templates/{Vagrantfile → Vagrantfile.erb} +2 -2
  69. data/templates/chef_server_client.erb +16 -0
  70. data/templates/chef_solo_solo.erb +4 -0
  71. data/templates/errors.yml +157 -0
  72. data/templates/package_Vagrantfile.erb +11 -0
  73. data/templates/ssh_config.erb +7 -0
  74. data/test/test_helper.rb +12 -15
  75. data/test/vagrant/actions/box/add_test.rb +1 -2
  76. data/test/vagrant/actions/box/destroy_test.rb +0 -1
  77. data/test/vagrant/actions/box/download_test.rb +40 -15
  78. data/test/vagrant/actions/box/unpackage_test.rb +2 -3
  79. data/test/vagrant/actions/collection_test.rb +8 -5
  80. data/test/vagrant/actions/runner_test.rb +8 -6
  81. data/test/vagrant/actions/vm/boot_test.rb +12 -11
  82. data/test/vagrant/actions/vm/customize_test.rb +2 -3
  83. data/test/vagrant/actions/vm/destroy_test.rb +2 -3
  84. data/test/vagrant/actions/vm/down_test.rb +16 -3
  85. data/test/vagrant/actions/vm/export_test.rb +4 -5
  86. data/test/vagrant/actions/vm/forward_ports_test.rb +6 -5
  87. data/test/vagrant/actions/vm/halt_test.rb +8 -2
  88. data/test/vagrant/actions/vm/import_test.rb +5 -5
  89. data/test/vagrant/actions/vm/move_hard_drive_test.rb +4 -6
  90. data/test/vagrant/actions/vm/package_test.rb +60 -22
  91. data/test/vagrant/actions/vm/provision_test.rb +7 -16
  92. data/test/vagrant/actions/vm/reload_test.rb +3 -2
  93. data/test/vagrant/actions/vm/resume_test.rb +0 -1
  94. data/test/vagrant/actions/vm/shared_folders_test.rb +17 -12
  95. data/test/vagrant/actions/vm/start_test.rb +10 -3
  96. data/test/vagrant/actions/vm/suspend_test.rb +1 -2
  97. data/test/vagrant/actions/vm/up_test.rb +19 -11
  98. data/test/vagrant/active_list_test.rb +148 -129
  99. data/test/vagrant/box_test.rb +26 -14
  100. data/test/vagrant/busy_test.rb +15 -6
  101. data/test/vagrant/command_test.rb +53 -0
  102. data/test/vagrant/commands/base_test.rb +118 -0
  103. data/test/vagrant/commands/box/add_test.rb +34 -0
  104. data/test/vagrant/commands/box/list_test.rb +32 -0
  105. data/test/vagrant/commands/box/remove_test.rb +41 -0
  106. data/test/vagrant/commands/destroy_test.rb +32 -0
  107. data/test/vagrant/commands/down_test.rb +17 -0
  108. data/test/vagrant/commands/halt_test.rb +28 -0
  109. data/test/vagrant/commands/init_test.rb +55 -0
  110. data/test/vagrant/commands/package_test.rb +84 -0
  111. data/test/vagrant/commands/reload_test.rb +28 -0
  112. data/test/vagrant/commands/resume_test.rb +33 -0
  113. data/test/vagrant/commands/ssh_config_test.rb +54 -0
  114. data/test/vagrant/commands/ssh_test.rb +32 -0
  115. data/test/vagrant/commands/status_test.rb +20 -0
  116. data/test/vagrant/commands/suspend_test.rb +33 -0
  117. data/test/vagrant/commands/up_test.rb +41 -0
  118. data/test/vagrant/config_test.rb +42 -17
  119. data/test/vagrant/downloaders/file_test.rb +7 -0
  120. data/test/vagrant/downloaders/http_test.rb +12 -0
  121. data/test/vagrant/environment_test.rb +595 -0
  122. data/test/vagrant/provisioners/base_test.rb +7 -1
  123. data/test/vagrant/provisioners/chef_server_test.rb +41 -51
  124. data/test/vagrant/provisioners/chef_solo_test.rb +93 -62
  125. data/test/vagrant/provisioners/chef_test.rb +61 -15
  126. data/test/vagrant/ssh_test.rb +166 -38
  127. data/test/vagrant/util/errors_test.rb +57 -0
  128. data/test/vagrant/util/progress_meter_test.rb +33 -0
  129. data/test/vagrant/{stacked_proc_runner_test.rb → util/stacked_proc_runner_test.rb} +3 -3
  130. data/test/vagrant/util/template_renderer_test.rb +138 -0
  131. data/test/vagrant/vm_test.rb +3 -2
  132. data/vagrant.gemspec +88 -33
  133. metadata +94 -51
  134. data/bin/vagrant-box +0 -34
  135. data/bin/vagrant-down +0 -27
  136. data/bin/vagrant-halt +0 -28
  137. data/bin/vagrant-init +0 -27
  138. data/bin/vagrant-package +0 -29
  139. data/bin/vagrant-reload +0 -29
  140. data/bin/vagrant-resume +0 -27
  141. data/bin/vagrant-ssh +0 -27
  142. data/bin/vagrant-status +0 -29
  143. data/bin/vagrant-suspend +0 -27
  144. data/bin/vagrant-up +0 -29
  145. data/lib/vagrant/commands.rb +0 -234
  146. data/lib/vagrant/env.rb +0 -189
  147. data/lib/vagrant/stacked_proc_runner.rb +0 -33
  148. data/test/vagrant/commands_test.rb +0 -269
  149. data/test/vagrant/env_test.rb +0 -418
@@ -1,418 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'test_helper')
2
-
3
- class EnvTest < Test::Unit::TestCase
4
- def mock_persisted_vm(returnvalue="foovm")
5
- filemock = mock("filemock")
6
- filemock.expects(:read).returns("foo")
7
- Vagrant::VM.expects(:find).with("foo").returns(returnvalue)
8
- File.expects(:open).with(Vagrant::Env.dotfile_path).once.yields(filemock)
9
- File.expects(:file?).with(Vagrant::Env.dotfile_path).once.returns(true)
10
- Vagrant::Env.load_vm!
11
- end
12
-
13
- setup do
14
- mock_config
15
- Vagrant::Box.stubs(:find).returns("foo")
16
- end
17
-
18
- context "checking virtualbox version" do
19
- setup do
20
- VirtualBox::Command.stubs(:version)
21
- end
22
-
23
- should "error and exit if VirtualBox is not installed or detected" do
24
- Vagrant::Env.expects(:error_and_exit).once
25
- VirtualBox::Command.expects(:version).returns(nil)
26
- Vagrant::Env.check_virtualbox!
27
- end
28
-
29
- should "error and exit if VirtualBox is lower than version 3.1" do
30
- Vagrant::Env.expects(:error_and_exit).once
31
- VirtualBox::Command.expects(:version).returns("3.0.12r1041")
32
- Vagrant::Env.check_virtualbox!
33
- end
34
- end
35
-
36
- context "requiring a VM" do
37
- setup do
38
- Vagrant::Env.stubs(:require_root_path)
39
- Vagrant::Env.stubs(:error_and_exit)
40
- end
41
-
42
- should "require root path" do
43
- Vagrant::Env.expects(:require_root_path).once
44
- Vagrant::Env.require_persisted_vm
45
- end
46
-
47
- should "error and exit if no persisted VM was found" do
48
- assert_nil Vagrant::Env.persisted_vm
49
- Vagrant::Env.expects(:error_and_exit).once
50
- Vagrant::Env.require_persisted_vm
51
- end
52
-
53
- should "return and continue if persisted VM is found" do
54
- mock_persisted_vm
55
- Vagrant::Env.expects(:error_and_exit).never
56
- Vagrant::Env.require_persisted_vm
57
- end
58
- end
59
-
60
- context "loading home directory" do
61
- setup do
62
- @home_dir = File.expand_path(Vagrant.config.vagrant.home)
63
-
64
- File.stubs(:directory?).returns(true)
65
- FileUtils.stubs(:mkdir_p)
66
- end
67
-
68
- should "create each directory if it doesn't exist" do
69
- create_seq = sequence("create_seq")
70
- File.stubs(:directory?).returns(false)
71
- Vagrant::Env::HOME_SUBDIRS.each do |subdir|
72
- FileUtils.expects(:mkdir_p).with(File.join(@home_dir, subdir)).in_sequence(create_seq)
73
- end
74
-
75
- Vagrant::Env.load_home_directory!
76
- end
77
-
78
- should "not create directories if they exist" do
79
- File.stubs(:directory?).returns(true)
80
- FileUtils.expects(:mkdir_p).never
81
- Vagrant::Env.load_home_directory!
82
- end
83
- end
84
-
85
- context "loading config" do
86
- setup do
87
- @root_path = "/foo"
88
- Vagrant::Env.stubs(:root_path).returns(@root_path)
89
- Vagrant::Env.stubs(:box).returns(nil)
90
- File.stubs(:exist?).returns(false)
91
- Vagrant::Config.stubs(:execute!)
92
- Vagrant::Config.stubs(:reset!)
93
- end
94
-
95
- should "reset the configuration object" do
96
- Vagrant::Config.expects(:reset!).once
97
- Vagrant::Env.load_config!
98
- end
99
-
100
- should "load from the project root" do
101
- File.expects(:exist?).with(File.join(PROJECT_ROOT, "config", "default.rb")).once
102
- Vagrant::Env.load_config!
103
- end
104
-
105
- should "load from the root path" do
106
- File.expects(:exist?).with(File.join(@root_path, Vagrant::Env::ROOTFILE_NAME)).once
107
- Vagrant::Env.load_config!
108
- end
109
-
110
- should "load from the home directory" do
111
- File.expects(:exist?).with(File.join(Vagrant::Env.home_path, Vagrant::Env::ROOTFILE_NAME)).once
112
- Vagrant::Env.load_config!
113
- end
114
-
115
- should "not load from the home directory if the home config is nil" do
116
- mock_config do |config|
117
- config.vagrant.home = nil
118
- end
119
-
120
- File.expects(:exist?).with(File.join(Vagrant::Env.home_path, Vagrant::Env::ROOTFILE_NAME)).never
121
- Vagrant::Env.load_config!
122
- end
123
-
124
- should "not load from the root path if nil" do
125
- Vagrant::Env.stubs(:root_path).returns(nil)
126
- File.expects(:exist?).with(File.join(@root_path, Vagrant::Env::ROOTFILE_NAME)).never
127
- Vagrant::Env.load_config!
128
- end
129
-
130
- should "not load from the box directory if it is nil" do
131
- Vagrant::Env.expects(:box).once.returns(nil)
132
- Vagrant::Env.load_config!
133
- end
134
-
135
- should "load from the box directory if it is not nil" do
136
- dir = "foo"
137
- box = mock("box")
138
- box.stubs(:directory).returns(dir)
139
- Vagrant::Env.expects(:box).twice.returns(box)
140
- File.expects(:exist?).with(File.join(dir, Vagrant::Env::ROOTFILE_NAME)).once
141
- Vagrant::Env.load_config!
142
- end
143
-
144
- should "load the files only if exist? returns true" do
145
- File.expects(:exist?).once.returns(true)
146
- Vagrant::Env.expects(:load).once
147
- Vagrant::Env.load_config!
148
- end
149
-
150
- should "not load the files if exist? returns false" do
151
- Vagrant::Env.expects(:load).never
152
- Vagrant::Env.load_config!
153
- end
154
-
155
- should "execute after loading" do
156
- File.expects(:exist?).once.returns(true)
157
- Vagrant::Env.expects(:load).once
158
- Vagrant::Config.expects(:execute!).once
159
- Vagrant::Env.load_config!
160
- end
161
- end
162
-
163
- context "initial load" do
164
- should "load! should load the config and set the persisted_uid" do
165
- call_seq = sequence("call_sequence")
166
- Vagrant::Env.expects(:load_root_path!).once.in_sequence(call_seq)
167
- Vagrant::Env.expects(:load_config!).once.in_sequence(call_seq)
168
- Vagrant::Env.expects(:load_home_directory!).once.in_sequence(call_seq)
169
- Vagrant::Env.expects(:load_box!).once.in_sequence(call_seq)
170
- Vagrant::Env.expects(:load_config!).once.in_sequence(call_seq)
171
- Vagrant::Env.expects(:check_virtualbox!).once.in_sequence(call_seq)
172
- Vagrant::Env.expects(:load_vm!).once.in_sequence(call_seq)
173
- Vagrant::Env.load!
174
- end
175
- end
176
-
177
- context "persisting the VM into a file" do
178
- setup do
179
- @vm = mock("vm")
180
- @vm.stubs(:uuid).returns("foo")
181
-
182
- File.stubs(:open)
183
- Vagrant::ActiveList.stubs(:add)
184
- end
185
-
186
- should "should save it to the dotfile path" do
187
- filemock = mock("filemock")
188
- filemock.expects(:write).with(@vm.uuid)
189
- File.expects(:open).with(Vagrant::Env.dotfile_path, 'w+').once.yields(filemock)
190
- Vagrant::Env.persist_vm(@vm)
191
- end
192
-
193
- should "add the VM to the activelist" do
194
- Vagrant::ActiveList.expects(:add).with(@vm)
195
- Vagrant::Env.persist_vm(@vm)
196
- end
197
- end
198
-
199
- context "depersisting the VM" do
200
- setup do
201
- File.stubs(:exist?).returns(false)
202
- File.stubs(:delete)
203
-
204
- Vagrant::ActiveList.stubs(:remove)
205
-
206
- @dotfile_path = "foo"
207
- Vagrant::Env.stubs(:dotfile_path).returns(@dotfile_path)
208
-
209
- @vm = mock("vm")
210
- end
211
-
212
- should "remove the dotfile if it exists" do
213
- File.expects(:exist?).with(Vagrant::Env.dotfile_path).returns(true)
214
- File.expects(:delete).with(Vagrant::Env.dotfile_path).once
215
- Vagrant::Env.depersist_vm(@vm)
216
- end
217
-
218
- should "not remove the dotfile if it doesn't exist" do
219
- File.expects(:exist?).returns(false)
220
- File.expects(:delete).never
221
- Vagrant::Env.depersist_vm(@vm)
222
- end
223
-
224
- should "remove from the active list" do
225
- Vagrant::ActiveList.expects(:remove).with(@vm)
226
- Vagrant::Env.depersist_vm(@vm)
227
- end
228
- end
229
-
230
- context "loading the UUID out from the persisted file" do
231
- setup do
232
- File.stubs(:file?).returns(true)
233
- end
234
-
235
- should "loading of the uuid from the dotfile" do
236
- mock_persisted_vm
237
- assert_equal 'foovm', Vagrant::Env.persisted_vm
238
- end
239
-
240
- should "do nothing if the root path is nil" do
241
- File.expects(:open).never
242
- Vagrant::Env.stubs(:root_path).returns(nil)
243
- Vagrant::Env.load_vm!
244
- end
245
-
246
- should "do nothing if dotfile is not a file" do
247
- File.expects(:file?).returns(false)
248
- File.expects(:open).never
249
- Vagrant::Env.load_vm!
250
- end
251
-
252
- should "uuid should be nil if dotfile didn't exist" do
253
- File.expects(:open).raises(Errno::ENOENT)
254
- Vagrant::Env.load_vm!
255
- assert_nil Vagrant::Env.persisted_vm
256
- end
257
-
258
- should "should build up the dotfile out of the root path and the dotfile name" do
259
- assert_equal File.join(Vagrant::Env.root_path, Vagrant.config.vagrant.dotfile_name), Vagrant::Env.dotfile_path
260
- end
261
- end
262
-
263
- context "loading the root path" do
264
- should "default the path to the pwd if nil" do
265
- @path = mock("path")
266
- @path.stubs(:root?).returns(true)
267
- Pathname.expects(:new).with(Dir.pwd).returns(@path)
268
- Vagrant::Env.load_root_path!(nil)
269
- end
270
-
271
- should "not default the path to pwd if its not nil" do
272
- @path = mock("path")
273
- @path.stubs(:to_s).returns("/")
274
- File.expects(:expand_path).with(@path).returns("/")
275
- Pathname.expects(:new).with("/").returns(@path)
276
- @path.stubs(:root?).returns(true)
277
- Vagrant::Env.load_root_path!(@path)
278
- end
279
-
280
- should "should walk the parent directories looking for rootfile" do
281
- paths = [
282
- Pathname.new("/foo/bar/baz"),
283
- Pathname.new("/foo/bar"),
284
- Pathname.new("/foo")
285
- ]
286
-
287
- search_seq = sequence("search_seq")
288
- paths.each do |path|
289
- File.expects(:exist?).with("#{path}/#{Vagrant::Env::ROOTFILE_NAME}").returns(false).in_sequence(search_seq)
290
- end
291
-
292
- assert !Vagrant::Env.load_root_path!(paths.first)
293
- end
294
-
295
- should "return false if not found" do
296
- path = Pathname.new("/")
297
- assert !Vagrant::Env.load_root_path!(path)
298
- end
299
-
300
- should "return false if not found on windows-style root" do
301
- # TODO: Is there _any_ way to test this on unix machines? The
302
- # expand path doesn't work [properly for the test] on unix machines.
303
- if RUBY_PLATFORM.downcase.include?("mswin")
304
- # Note the escaped back slash
305
- path = Pathname.new("C:\\")
306
- assert !Vagrant::Env.load_root_path!(path)
307
- end
308
- end
309
-
310
- should "should set the path for the rootfile" do
311
- path = "/foo"
312
- File.expects(:exist?).with("#{path}/#{Vagrant::Env::ROOTFILE_NAME}").returns(true)
313
-
314
- assert Vagrant::Env.load_root_path!(Pathname.new(path))
315
- assert_equal path, Vagrant::Env.root_path
316
- end
317
- end
318
-
319
- context "home directory paths" do
320
- should "return the expanded config for `home_path`" do
321
- assert_equal File.expand_path(Vagrant.config.vagrant.home), Vagrant::Env.home_path
322
- end
323
-
324
- should "return the home_path joined with tmp for a tmp path" do
325
- @home_path = "foo"
326
- Vagrant::Env.stubs(:home_path).returns(@home_path)
327
- assert_equal File.join(@home_path, "tmp"), Vagrant::Env.tmp_path
328
- end
329
-
330
- should "return the boxes path" do
331
- @home_path = "foo"
332
- Vagrant::Env.stubs(:home_path).returns(@home_path)
333
- assert_equal File.join(@home_path, "boxes"), Vagrant::Env.boxes_path
334
- end
335
- end
336
-
337
- context "loading box" do
338
- setup do
339
- @box = mock("box")
340
-
341
- Vagrant::Env.stubs(:load_config!)
342
- Vagrant::Env.stubs(:root_path).returns("foo")
343
- end
344
-
345
- should "do nothing if the root path is nil" do
346
- Vagrant::Box.expects(:find).never
347
- Vagrant::Env.stubs(:root_path).returns(nil)
348
- Vagrant::Env.load_vm!
349
- end
350
-
351
- should "not load the box if its not set" do
352
- mock_config do |config|
353
- config.vm.box = nil
354
- end
355
-
356
- Vagrant::Box.expects(:find).never
357
- Vagrant::Env.load_box!
358
- end
359
-
360
- should "set the box to what is found by the Box class" do
361
- Vagrant::Box.expects(:find).with(Vagrant.config.vm.box).once.returns(@box)
362
- Vagrant::Env.load_box!
363
- assert @box.equal?(Vagrant::Env.box)
364
- end
365
- end
366
-
367
- context "requiring boxes" do
368
- setup do
369
- Vagrant::Env.stubs(:require_root_path)
370
- Vagrant::Env.stubs(:error_and_exit)
371
- end
372
-
373
- should "require root path" do
374
- Vagrant::Env.expects(:require_root_path).once
375
- Vagrant::Env.require_box
376
- end
377
-
378
- should "error and exit if no box is found" do
379
- mock_config do |config|
380
- config.vm.box = nil
381
- end
382
-
383
- Vagrant::Env.expects(:box).returns(nil)
384
- Vagrant::Env.expects(:error_and_exit).once.with() do |msg|
385
- assert msg =~ /no base box was specified/i
386
- true
387
- end
388
- Vagrant::Env.require_box
389
- end
390
-
391
- should "error and exit if box is specified but doesn't exist" do
392
- mock_config do |config|
393
- config.vm.box = "foo"
394
- end
395
-
396
- Vagrant::Env.expects(:box).returns(nil)
397
- Vagrant::Env.expects(:error_and_exit).once.with() do |msg|
398
- assert msg =~ /does not exist/i
399
- true
400
- end
401
- Vagrant::Env.require_box
402
- end
403
- end
404
-
405
- context "requiring root_path" do
406
- should "error and exit if no root_path is set" do
407
- Vagrant::Env.expects(:root_path).returns(nil)
408
- Vagrant::Env.expects(:error_and_exit).once
409
- Vagrant::Env.require_root_path
410
- end
411
-
412
- should "not error and exit if root_path is set" do
413
- Vagrant::Env.expects(:root_path).returns("foo")
414
- Vagrant::Env.expects(:error_and_exit).never
415
- Vagrant::Env.require_root_path
416
- end
417
- end
418
- end