From d9986034b381a7b0871ae48b4292d776f394cb85 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 13 Feb 2010 11:38:11 -0800 Subject: [PATCH] Base action tests --- lib/vagrant.rb | 1 + test/vagrant/actions/base_test.rb | 32 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/vagrant/actions/base_test.rb diff --git a/lib/vagrant.rb b/lib/vagrant.rb index 6eae2302a..a4e2456d1 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -19,3 +19,4 @@ require 'vagrant/env' require 'vagrant/provisioning' require 'vagrant/ssh' require 'vagrant/vm' +require 'vagrant/actions/base' \ No newline at end of file diff --git a/test/vagrant/actions/base_test.rb b/test/vagrant/actions/base_test.rb new file mode 100644 index 000000000..996bc3e09 --- /dev/null +++ b/test/vagrant/actions/base_test.rb @@ -0,0 +1,32 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class BaseActionTest < Test::Unit::TestCase + should "include the util class so subclasses have access to it" do + assert Vagrant::Actions::Base.include?(Vagrant::Util) + end + + context "base instance" do + setup do + @mock_vm = mock("vm") + @base = Vagrant::Actions::Base.new(@mock_vm) + end + + should "allow read-only access to the VM" do + assert_equal @mock_vm, @base.vm + end + + should "implement prepare which does nothing" do + assert_nothing_raised do + assert @base.respond_to?(:prepare) + @base.prepare + end + end + + should "implement the execute! method which does nothing" do + assert_nothing_raised do + assert @base.respond_to?(:execute!) + @base.execute! + end + end + end +end