Extracted Logic for vim in seperate class
[vagrant-dotfiles.git] / spec / copy_my_conf_spec.rb
1 require "spec_helper"
2
3 module Vagrant
4 module Provisioners
5 describe CopyMyConf do
6 before(:each) do
7 env_vm = Object.new
8 env_vm_config = Object.new
9 @mock_vm = Object.new
10 @config = CopyMyConf.config_class.new
11 @env_channel = Object.new
12
13 CopyMyConf.any_instance.stub(:env).and_return({:vm => env_vm})
14 env_vm.stub(:config).and_return(env_vm_config)
15 env_vm.stub(:channel).and_return(@env_channel)
16 env_vm_config.stub(:vm).and_return(@mock_vm)
17 CopyMyConf.any_instance.stub(:config).and_return(@config)
18 end
19
20 it "should prepare provisioning process" do
21 @config.should_receive(:all_true).and_return([:vim])
22 CopyMyConf::Vim.any_instance.should_receive(:prepare).with(@mock_vm, anything)
23
24 CopyMyConf.new.prepare
25 end
26
27 it "should provision the vm" do
28 @config.stub(:all_true).and_return([:vim])
29 copy_my_conf = CopyMyConf.new
30
31 CopyMyConf::Vim.any_instance.stub(:prepare)
32 copy_my_conf.prepare
33
34 CopyMyConf::Vim.any_instance.should_receive(:provision).with(@env_channel, anything, anything)
35 copy_my_conf.provision!
36 end
37 end
38 end
39 end