beaker-vagrant 0.7.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Beaker::VagrantDesktop do
4
- let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
5
- let( :vagrant ) { described_class.new( hosts, options ) }
6
- let( :hosts ) { make_hosts }
4
+ let(:options) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double.as_null_object }) }
5
+ let(:vagrant) { described_class.new(hosts, options) }
6
+ let(:hosts) { make_hosts }
7
7
 
8
- it "uses the vmware_desktop provider for provisioning" do
8
+ it 'uses the vmware_desktop provider for provisioning' do
9
9
  hosts.each do |host|
10
10
  host_prev_name = host['user']
11
- expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
12
- expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
13
- expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
11
+ expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
12
+ expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
13
+ expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
14
14
  end
15
- expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
16
- expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider vmware_desktop" ).once
15
+ expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
16
+ expect(vagrant).to receive(:vagrant_cmd).with('up --provider vmware_desktop').once
17
17
  FakeFS do
18
18
  vagrant.provision
19
19
  end
@@ -27,32 +27,32 @@ describe Beaker::VagrantDesktop do
27
27
  end
28
28
  end
29
29
 
30
- it "for a set of hosts" do
31
- is_expected.to include( %Q{ v.vm.provider :vmware_desktop do |v|\n v.vmx['memsize'] = '1024'\n end})
30
+ it 'for a set of hosts' do
31
+ is_expected.to include(%( v.vm.provider :vmware_desktop do |v|\n v.vmx['memsize'] = '1024'\n end))
32
32
  end
33
33
 
34
34
  context 'with whitelist_verified' do
35
- let(:hosts) { make_hosts({:whitelist_verified => true}, 1) }
35
+ let(:hosts) { make_hosts({ whitelist_verified: true }, 1) }
36
36
 
37
- it { is_expected.to include( %Q{ v.vmx['whitelist_verified'] = 'true'}) }
37
+ it { is_expected.to include(%( v.vmx['whitelist_verified'] = 'true')) }
38
38
  end
39
39
 
40
40
  context 'with functional_hgfs' do
41
- let(:hosts) { make_hosts({:functional_hgfs => true}, 1) }
41
+ let(:hosts) { make_hosts({ functional_hgfs: true }, 1) }
42
42
 
43
- it { is_expected.to include( %Q{ v.vmx['functional_hgfs'] = 'true'}) }
43
+ it { is_expected.to include(%( v.vmx['functional_hgfs'] = 'true')) }
44
44
  end
45
45
 
46
46
  context 'with unmount_default_hgfs' do
47
- let(:hosts) { make_hosts({:unmount_default_hgfs => true}, 1) }
47
+ let(:hosts) { make_hosts({ unmount_default_hgfs: true }, 1) }
48
48
 
49
- it { is_expected.to include( %Q{ v.vmx['unmount_default_hgfs'] = 'true'}) }
49
+ it { is_expected.to include(%( v.vmx['unmount_default_hgfs'] = 'true')) }
50
50
  end
51
51
 
52
- context "with gui" do
53
- let(:hosts) { make_hosts({:gui => true},1) }
52
+ context 'with gui' do
53
+ let(:hosts) { make_hosts({ gui: true }, 1) }
54
54
 
55
- it { is_expected.to include( %Q{ v.vmx['gui'] = true}) }
55
+ it { is_expected.to include(%( v.vmx['gui'] = true)) }
56
56
  end
57
57
  end
58
58
  end
@@ -1,32 +1,32 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Beaker::VagrantFusion do
4
- let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
5
- let( :vagrant ) { described_class.new( hosts, options ) }
6
- let( :hosts ) { make_hosts() }
4
+ let(:options) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double.as_null_object }) }
5
+ let(:vagrant) { described_class.new(hosts, options) }
6
+ let(:hosts) { make_hosts }
7
7
 
8
- it "uses the vmware_fusion provider for provisioning" do
8
+ it 'uses the vmware_fusion provider for provisioning' do
9
9
  hosts.each do |host|
10
10
  host_prev_name = host['user']
11
- expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
12
- expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
13
- expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
11
+ expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
12
+ expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
13
+ expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
14
14
  end
15
- expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
16
- expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider vmware_fusion" ).once
15
+ expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
16
+ expect(vagrant).to receive(:vagrant_cmd).with('up --provider vmware_fusion').once
17
17
  vagrant.provision
18
18
  end
19
19
 
20
20
  context 'Correct vagrant configuration' do
21
21
  subject do
22
22
  FakeFS do
23
- vagrant.make_vfile( hosts, options )
23
+ vagrant.make_vfile(hosts, options)
24
24
  File.read(vagrant.instance_variable_get(:@vagrant_file))
25
25
  end
26
26
  end
27
27
 
28
28
  it 'has a provider section' do
29
- is_expected.to include( %Q{ v.vm.provider :vmware_fusion do |v|\n v.vmx['memsize'] = '1024'\n end})
29
+ is_expected.to include(%( v.vm.provider :vmware_fusion do |v|\n v.vmx['memsize'] = '1024'\n end))
30
30
  end
31
31
  end
32
32
  end
@@ -1,27 +1,28 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Beaker::VagrantLibvirt do
4
- let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg',
5
- 'logger' => double().as_null_object,
6
- 'libvirt' => { 'uri' => 'qemu+ssh://root@host/system'},
7
- 'vagrant_cpus' => 2,
8
- }) }
9
- let( :vagrant ) { described_class.new( hosts, options ) }
10
- let( :hosts ) do
11
- make_hosts().each do |host|
4
+ let(:options) do
5
+ make_opts.merge({ :hosts_file => 'sample.cfg',
6
+ 'logger' => double.as_null_object,
7
+ 'libvirt' => { 'uri' => 'qemu+ssh://root@host/system' },
8
+ 'vagrant_cpus' => 2, })
9
+ end
10
+ let(:vagrant) { described_class.new(hosts, options) }
11
+ let(:hosts) do
12
+ make_hosts.each do |host|
12
13
  host.delete('ip')
13
14
  end
14
15
  end
15
16
 
16
- it "uses the vagrant_libvirt provider for provisioning" do
17
+ it 'uses the vagrant_libvirt provider for provisioning' do
17
18
  hosts.each do |host|
18
19
  host_prev_name = host['user']
19
- expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
20
- expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
21
- expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
20
+ expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
21
+ expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
22
+ expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
22
23
  end
23
- expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
24
- expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider libvirt" ).once
24
+ expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
25
+ expect(vagrant).to receive(:vagrant_cmd).with('up --provider libvirt').once
25
26
  FakeFS do
26
27
  vagrant.provision
27
28
  end
@@ -30,28 +31,28 @@ describe Beaker::VagrantLibvirt do
30
31
  context 'Correct vagrant configuration' do
31
32
  subject do
32
33
  FakeFS do
33
- vagrant.make_vfile( hosts, options )
34
+ vagrant.make_vfile(hosts, options)
34
35
  File.read(vagrant.instance_variable_get(:@vagrant_file))
35
36
  end
36
37
  end
37
38
 
38
39
  it 'has a provider section' do
39
- is_expected.to include( %Q{ v.vm.provider :libvirt do |node|})
40
+ is_expected.to include(%( v.vm.provider :libvirt do |node|))
40
41
  end
41
42
 
42
- it "has no private network" do
43
+ it 'has no private network' do
43
44
  is_expected.to include('v.vm.network :private_network')
44
45
  end
45
46
 
46
- it "can specify the memory as an integer" do
47
+ it 'can specify the memory as an integer' do
47
48
  is_expected.to include('node.memory = 1024')
48
49
  end
49
50
 
50
- it "can specify the number of cpus" do
51
- is_expected.to include("node.cpus = 2")
51
+ it 'can specify the number of cpus' do
52
+ is_expected.to include('node.cpus = 2')
52
53
  end
53
54
 
54
- it "can specify any libvirt option" do
55
+ it 'can specify any libvirt option' do
55
56
  is_expected.to include("node.uri = 'qemu+ssh://root@host/system'")
56
57
  end
57
58
  end
@@ -1,40 +1,40 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Beaker::VagrantParallels do
4
- let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
5
- let( :vagrant ) { Beaker::VagrantParallels.new( hosts, options ) }
6
- let( :hosts ) { make_hosts }
4
+ let(:options) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double.as_null_object }) }
5
+ let(:vagrant) { Beaker::VagrantParallels.new(hosts, options) }
6
+ let(:hosts) { make_hosts }
7
7
 
8
- it "uses the parallels provider for provisioning" do
8
+ it 'uses the parallels provider for provisioning' do
9
9
  hosts.each do |host|
10
10
  host_prev_name = host['user']
11
- expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
12
- expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
13
- expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
11
+ expect(vagrant).to receive(:set_ssh_config).with(host, 'vagrant').once
12
+ expect(vagrant).to receive(:copy_ssh_to_root).with(host, options).once
13
+ expect(vagrant).to receive(:set_ssh_config).with(host, host_prev_name).once
14
14
  end
15
- expect( vagrant ).to receive( :hack_etc_hosts ).with( hosts, options ).once
16
- expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider parallels" ).once
15
+ expect(vagrant).to receive(:hack_etc_hosts).with(hosts, options).once
16
+ expect(vagrant).to receive(:vagrant_cmd).with('up --provider parallels').once
17
17
  vagrant.provision
18
18
  end
19
19
 
20
20
  context 'Correct vagrant configuration' do
21
21
  subject do
22
22
  FakeFS do
23
- vagrant.make_vfile( hosts, options )
23
+ vagrant.make_vfile(hosts, options)
24
24
  File.read(vagrant.instance_variable_get(:@vagrant_file))
25
25
  end
26
26
  end
27
27
 
28
- it "can make a Vagrantfile for a set of hosts" do
29
- is_expected.to include( %Q{ v.vm.provider :parallels do |prl|\n prl.optimize_power_consumption = false\n prl.memory = '1024'\n end})
28
+ it 'can make a Vagrantfile for a set of hosts' do
29
+ is_expected.to include(%( v.vm.provider :parallels do |prl|\n prl.optimize_power_consumption = false\n prl.memory = '1024'\n end))
30
30
  end
31
31
  end
32
32
 
33
33
  context 'disabled guest tools' do
34
- let(:options) { super().merge({ :prl_update_guest_tools => 'disable' }) }
35
- subject { vagrant.class.provider_vfile_section( hosts.first, options ) }
34
+ let(:options) { super().merge({ prl_update_guest_tools: 'disable' }) }
35
+ subject { vagrant.class.provider_vfile_section(hosts.first, options) }
36
36
 
37
- it "can disable the auto-update functionality of the Parallels Guest Tools" do
37
+ it 'can disable the auto-update functionality of the Parallels Guest Tools' do
38
38
  is_expected.to match(/prl.update_guest_tools = false/)
39
39
  end
40
40
  end