Sha256: 437cd2bce1eacabaf7ec932f2d2f8c40e1df409b1d1a61d43b7e9a8c43bdacfa
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
require 'spec_helper' describe Beaker::VagrantCustom do let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) } let( :vagrant ) { Beaker::VagrantCustom.new( @hosts, options ) } let(:test_dir) { 'tmp/tests' } let(:custom_vagrant_file_path) { File.expand_path(test_dir + '/CustomVagrantfile') } before :each do @hosts = make_hosts() end it "uses the vagrant_custom provider for provisioning" do @hosts.each do |host| host_prev_name = host['user'] expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once end expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once expect( vagrant ).to receive( :vagrant_cmd ).with( "up" ).once FakeFS do vagrant.provision end end context 'takes vagrant configuration from existing file' do it 'writes the vagrant file to the correct location' do options.merge!({ :vagrantfile_path => custom_vagrant_file_path }) create_files([custom_vagrant_file_path]) vagrant_file_contents = <<-EOF FOO EOF File.open(custom_vagrant_file_path, 'w') { |file| file.write(vagrant_file_contents) } vagrant_copy_location = "#{test_dir}/NewVagrantLocation" vagrant.instance_variable_set(:@vagrant_file, vagrant_copy_location) vagrant.make_vfile(@hosts, options) vagrant_copy_file = File.open(vagrant_copy_location, 'r') expect(vagrant_copy_file.read).to be === vagrant_file_contents end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
beaker-vagrant-0.7.1 | spec/beaker/hypervisor/vagrant_custom_spec.rb |
beaker-vagrant-0.7.0 | spec/beaker/hypervisor/vagrant_custom_spec.rb |