moved unpackage to warden
This commit is contained in:
parent
30a84c6e50
commit
220fff0c19
|
@ -25,11 +25,9 @@ module Vagrant
|
|||
decompress
|
||||
|
||||
@app.call(@env)
|
||||
|
||||
cleanup if @env.error?
|
||||
end
|
||||
|
||||
def cleanup
|
||||
def recover(env)
|
||||
if File.directory?(box_directory)
|
||||
FileUtils.rm_rf(box_directory)
|
||||
end
|
||||
|
|
|
@ -21,7 +21,6 @@ class UnpackageBoxActionTest < Test::Unit::TestCase
|
|||
@instance.expects(:setup_box_directory).in_sequence(seq).returns(true)
|
||||
@instance.expects(:decompress).in_sequence(seq)
|
||||
@app.expects(:call).with(@env)
|
||||
@instance.expects(:cleanup).never
|
||||
@instance.call(@env)
|
||||
end
|
||||
|
||||
|
@ -29,18 +28,6 @@ class UnpackageBoxActionTest < Test::Unit::TestCase
|
|||
@instance.expects(:setup_box_directory).returns(false)
|
||||
@instance.expects(:decompress).never
|
||||
@app.expects(:call).never
|
||||
@instance.expects(:cleanup).never
|
||||
@instance.call(@env)
|
||||
end
|
||||
|
||||
should "cleanup if there was an error" do
|
||||
@env.error!(:foo)
|
||||
|
||||
seq = sequence("sequence")
|
||||
@instance.expects(:setup_box_directory).in_sequence(seq).returns(true)
|
||||
@instance.expects(:decompress).in_sequence(seq)
|
||||
@app.expects(:call).with(@env)
|
||||
@instance.expects(:cleanup).once
|
||||
@instance.call(@env)
|
||||
end
|
||||
end
|
||||
|
@ -54,13 +41,13 @@ class UnpackageBoxActionTest < Test::Unit::TestCase
|
|||
|
||||
should "do nothing if not a directory" do
|
||||
FileUtils.expects(:rm_rf).never
|
||||
@instance.cleanup
|
||||
@instance.recover(nil)
|
||||
end
|
||||
|
||||
should "remove the directory if exists" do
|
||||
File.expects(:directory?).with(@instance.box_directory).once.returns(true)
|
||||
FileUtils.expects(:rm_rf).with(@instance.box_directory).once
|
||||
@instance.cleanup
|
||||
@instance.recover(nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue