From 465392f99c858565fc74f3fb41925877ff2d7095 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 30 Sep 2010 00:55:00 -0700 Subject: [PATCH] config.vagrant validation tests --- test/vagrant/config/vagrant_test.rb | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/test/vagrant/config/vagrant_test.rb b/test/vagrant/config/vagrant_test.rb index 761c3a4fb..a2436dee0 100644 --- a/test/vagrant/config/vagrant_test.rb +++ b/test/vagrant/config/vagrant_test.rb @@ -6,6 +6,38 @@ class ConfigVagrantTest < Test::Unit::TestCase end context "validation" do - # TODO + setup do + @config.dotfile_name = "foo" + @config.home = "foo" + @config.host = "foo" + + @errors = Vagrant::Config::ErrorRecorder.new + end + + should "be valid with given set of values" do + @config.validate(@errors) + assert @errors.errors.empty? + end + + should "be invalid with no dotfile" do + @config.dotfile_name = nil + + @config.validate(@errors) + assert !@errors.errors.empty? + end + + should "be invalid with no home" do + @config.home = nil + + @config.validate(@errors) + assert !@errors.errors.empty? + end + + should "be invalid with no host" do + @config.host = nil + + @config.validate(@errors) + assert !@errors.errors.empty? + end end end