X-Git-Url: https://pwan.org/git/?p=vagrant-dotfiles.git;a=blobdiff_plain;f=spec%2Fvagrant-dotfiles.rb;fp=spec%2Fvagrant-dotfiles.rb;h=4c8c440488c1e18115048fedcab593b7673e4d4f;hp=0000000000000000000000000000000000000000;hb=e83a68ac49cf7bf169e58b5706605b072b4966a3;hpb=fa35bc36a5430811c454bc6f93aca0f6bdf20348 diff --git a/spec/vagrant-dotfiles.rb b/spec/vagrant-dotfiles.rb new file mode 100644 index 0000000..4c8c440 --- /dev/null +++ b/spec/vagrant-dotfiles.rb @@ -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