Only check for box directory if it is set during unpackage recovery [related to GH-170]
This commit is contained in:
parent
11e775b03b
commit
61314c5e21
|
@ -31,7 +31,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def recover(env)
|
def recover(env)
|
||||||
if File.directory?(box_directory)
|
if box_directory && File.directory?(box_directory)
|
||||||
FileUtils.rm_rf(box_directory)
|
FileUtils.rm_rf(box_directory)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,6 +26,13 @@ class UnpackageBoxActionTest < Test::Unit::TestCase
|
||||||
FileUtils.stubs(:rm_rf)
|
FileUtils.stubs(:rm_rf)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "do nothing if box directory is not set" do
|
||||||
|
@instance.stubs(:box_directory).returns(nil)
|
||||||
|
File.expects(:directory?).never
|
||||||
|
FileUtils.expects(:rm_rf).never
|
||||||
|
@instance.recover(nil)
|
||||||
|
end
|
||||||
|
|
||||||
should "do nothing if not a directory" do
|
should "do nothing if not a directory" do
|
||||||
FileUtils.expects(:rm_rf).never
|
FileUtils.expects(:rm_rf).never
|
||||||
@instance.recover(nil)
|
@instance.recover(nil)
|
||||||
|
|
Loading…
Reference in New Issue