-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathinstall_spec.rb
47 lines (39 loc) · 1.52 KB
/
install_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'spec_helper'
describe 'peadm::subplans::install' do
# Include the BoltSpec library functions
include BoltSpec::Plans
it 'minimum variables to run' do
allow_any_task
allow_any_plan
allow_any_command
allow_task('peadm::precheck').return_for_targets(
'primary' => {
'hostname' => 'primary',
'platform' => 'el-7.11-x86_64'
},
)
#########
## <🤮>
# rubocop:disable AnyInstance
allow(Tempfile).to receive(:new).and_call_original
allow(Pathname).to receive(:new).and_call_original
allow(Puppet::FileSystem).to receive(:exist?).and_call_original
allow_any_instance_of(BoltSpec::Plans::MockExecutor).to receive(:module_file_id).and_call_original
mockfile = instance_double('Tempfile', path: '/mock', write: nil, flush: nil, close: nil, unlink: nil)
mockpath = instance_double('Pathname', absolute?: true)
allow(Tempfile).to receive(:new).with('peadm').and_return(mockfile)
allow(Pathname).to receive(:new).with('/mock').and_return(mockpath)
allow(Puppet::FileSystem).to receive(:exist?).with('/mock').and_return(true)
allow_any_instance_of(BoltSpec::Plans::MockExecutor).to receive(:module_file_id).with('/mock').and_return('/mock')
allow_upload('/mock')
# rubocop:enable AnyInstance
## </🤮>
##########
params = {
'primary_host' => 'primary',
'console_password' => 'puppetlabs',
'version' => '2019.8.11',
}
expect(run_plan('peadm::subplans::install', params)).to be_ok
end
end