From b72cf4c57cc91b3d8f6bd7d56fb8f8ba45d94603 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 30 Aug 2010 20:09:26 -0700 Subject: [PATCH] Convert NFS to new Warden style with 'recover' method --- lib/vagrant/action/vm/nfs.rb | 5 +++-- test/vagrant/action/vm/nfs_test.rb | 18 +++++------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/vagrant/action/vm/nfs.rb b/lib/vagrant/action/vm/nfs.rb index 3ebd1442b..067f3bfc0 100644 --- a/lib/vagrant/action/vm/nfs.rb +++ b/lib/vagrant/action/vm/nfs.rb @@ -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. diff --git a/test/vagrant/action/vm/nfs_test.rb b/test/vagrant/action/vm/nfs_test.rb index bad1e4502..cb5749e6b 100644 --- a/test/vagrant/action/vm/nfs_test.rb +++ b/test/vagrant/action/vm/nfs_test.rb @@ -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