module Vagrant
module Provisioners
describe CopyMyConf do
- xit "should prepare provisioning process" do
- copy_my_conf = CopyMyConf.new
+ before(:each) do
+ env_vm = Object.new
+ env_vm_config = Object.new
+ @mock_vm = Object.new
+ @config = CopyMyConf.config_class.new
+ @env_channel = Object.new
+
+ CopyMyConf.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)
+ CopyMyConf.any_instance.stub(:config).and_return(@config)
+ end
+
+ it "should prepare provisioning process" do
+ @config.should_receive(:all_true).and_return([:vim])
+ CopyMyConf::Vim.any_instance.should_receive(:prepare).with(@mock_vm, anything)
- config = CopyMyConf.config_class.new
- config.vim = true
+ CopyMyConf.new.prepare
+ end
+
+ it "should provision the vm" do
+ @config.stub(:all_true).and_return([:vim])
+ copy_my_conf = CopyMyConf.new
- copy_my_conf.stub(:config).and_return(config)
+ CopyMyConf::Vim.any_instance.stub(:prepare)
+ copy_my_conf.prepare
- CopyMyConf::Vim.any_instance.should_receive(:prepare)
+ CopyMyConf::Vim.any_instance.should_receive(:provision).with(@env_channel, anything, anything)
+ copy_my_conf.provision!
end
end
end