Sha256: 3a4f4983abb3bb52745e0d8df7d19cac585ee465001fe1992f640a8cf6103502
Contents?: true
Size: 1.61 KB
Versions: 3
Compression:
Stored size: 1.61 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.write(custom_vagrant_file_path, 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
3 entries across 3 versions & 1 rubygems