forked from sous-chefs/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathibm_tar_spec.rb
More file actions
34 lines (28 loc) · 1.09 KB
/
Copy pathibm_tar_spec.rb
File metadata and controls
34 lines (28 loc) · 1.09 KB
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
require 'spec_helper'
describe 'java::ibm_tar' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.node.set['java']['java_home'] = '/home/java'
runner.node.set['java']['install_flavor'] = 'ibm'
runner.node.set['java']['ibm']['url'] = 'http://example.com/ibm-java.tar.gz'
runner.node.set['java']['ibm']['checksum'] = 'deadbeef'
runner.converge(described_recipe)
end
it 'downloads the remote jdk file' do
expect(chef_run).to create_remote_file(Chef::Config[:file_cache_path] + '/ibm-java.tar.gz')
end
it 'create java_home directory' do
expect(chef_run).to create_directory('/home/java')
end
it 'untar the jdk file' do
expect(chef_run).to run_execute('untar-ibm-java').with(
:command => 'tar xzf ./ibm-java.tar.gz -C /home/java --strip 1',
:creates => '/home/java/jre/bin/java'
)
untar_command = chef_run.execute('untar-ibm-java')
expect(untar_command).to notify('java_alternatives[set-java-alternatives]')
end
it 'includes the set_java_home recipe' do
expect(chef_run).to include_recipe('java::set_java_home')
end
end