From e158a01d69f394c7b3b86154f3be8c8024a6384e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 12 Jul 2010 22:41:41 -0700 Subject: [PATCH] BSD host properly tests for `nfsd` binary --- lib/vagrant/hosts/bsd.rb | 4 ++-- test/vagrant/hosts/bsd_test.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/hosts/bsd.rb b/lib/vagrant/hosts/bsd.rb index 2c555f11d..174273992 100644 --- a/lib/vagrant/hosts/bsd.rb +++ b/lib/vagrant/hosts/bsd.rb @@ -5,8 +5,8 @@ module Vagrant include Util def nfs? - # TODO: verify it exists - true + system("which nfsd") + $?.to_i == 0 end def nfs_export(ip, folders) diff --git a/test/vagrant/hosts/bsd_test.rb b/test/vagrant/hosts/bsd_test.rb index ccb39134b..4d852cc69 100644 --- a/test/vagrant/hosts/bsd_test.rb +++ b/test/vagrant/hosts/bsd_test.rb @@ -10,8 +10,22 @@ class BSDHostTest < Test::Unit::TestCase context "supporting nfs check" do should "support NFS" do + @instance.expects(:system).with() do |cmd| + `which which` + true + end + assert @instance.nfs? end + + should "not support NFS if nfsd is not found" do + @instance.expects(:system).with() do |cmd| + `which thisshouldnoteverneverexist` + true + end + + assert !@instance.nfs? + end end context "nfs export" do