Checkpoint / the simplest test looks to be working now (~/.vimrc)
[vagrant-dotfiles.git] / spec / vagrant-dotfiles.rb
diff --git a/spec/vagrant-dotfiles.rb b/spec/vagrant-dotfiles.rb
new file mode 100644 (file)
index 0000000..4c8c440
--- /dev/null
@@ -0,0 +1,39 @@
+require "spec_helper"
+
+module Vagrant
+  module Provisioners
+    describe VagrantDotfiles do
+      before(:each) do
+        env_vm = Object.new
+        env_vm_config = Object.new
+        @mock_vm = Object.new
+        @config = VagrantDotfiles.config_class.new
+        @env_channel = Object.new
+
+        VagrantDotfiles.any_instance.stub(:env).and_return({:vm => env_vm})
+        env_vm.stub(:config).and_return(env_vm_config)
+        env_vm.stub(:channel).and_return(@env_channel)
+        env_vm_config.stub(:vm).and_return(@mock_vm)
+        VagrantDotfiles.any_instance.stub(:config).and_return(@config)
+      end
+
+      it "should prepare provisioning process" do
+        @config.should_receive(:all_enabled_attributes).and_return([VagrantDotfiles::Vim.new])
+        VagrantDotfiles::Vim.any_instance.should_receive(:prepare).with(@mock_vm, anything)
+
+        VagrantDotfiles.new.prepare
+      end
+
+      it "should provision the vm" do
+        @config.stub(:all_enabled_attributes).and_return([VagrantDotfiles::Vim.new])
+        vagrant_dotfiles = VagrantDotfiles.new
+
+        VagrantDotfiles::Vim.any_instance.stub(:prepare)
+        vagrant_dotfiles.prepare
+
+        VagrantDotfiles::Vim.any_instance.should_receive(:provision).with(@env_channel, anything, anything)
+        vagrant_dotfiles.provision!
+      end
+    end
+  end
+end