Convert NFS to new Warden style with 'recover' method

This commit is contained in:
Mitchell Hashimoto 2010-08-30 20:09:26 -07:00
parent aa00d15206
commit b72cf4c57c
2 changed files with 8 additions and 15 deletions

View File

@ -40,9 +40,10 @@ module Vagrant
@app.call(env)
mount_folders if !folders.empty?
end
# TODO: Make recover method
clear_nfs_exports(env) if env.error?
def recover(env)
clear_nfs_exports(env)
end
# Returns the folders which are to be synced via NFS.

View File

@ -65,20 +65,12 @@ class NFSVMActionTest < Test::Unit::TestCase
@instance.expects(:mount_folders).never
@instance.call(@env)
end
end
should "not mount folders if an error occured" do
seq = sequence("seq")
@app.expects(:call).in_sequence(seq).with() do
# Use this mark the env as error
@env.error!(:foo)
true
end
@instance.expects(:clear_nfs_exports).with(@env).in_sequence(seq)
@instance.expects(:mount_folders).never
@instance.call(@env)
context "recovery" do
should "clear NFS exports" do
@instance.expects(:clear_nfs_exports).with(@env).once
@instance.recover(@env)
end
end