forked from sous-chefs/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_java_home_spec.rb
More file actions
40 lines (33 loc) · 1.28 KB
/
Copy pathset_java_home_spec.rb
File metadata and controls
40 lines (33 loc) · 1.28 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
35
36
37
38
39
40
require 'spec_helper'
describe 'java::set_java_home' do
context 'set_java_home' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new
runner.node.override['java']['java_home'] = '/opt/java'
runner.converge(described_recipe)
end
it 'should create the profile.d directory' do
expect(chef_run).to create_directory('/etc/profile.d')
end
it 'should create jdk.sh with the java home environment variable' do
expect(chef_run).to render_file('/etc/profile.d/jdk.sh').with_content('export JAVA_HOME=/opt/java')
end
it 'should not create /etc/environment with the java home variable' do
expect(chef_run).to_not run_ruby_block('Set JAVA_HOME in /etc/environment')
end
end
context 'set_java_home_environment' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new
runner.node.override['java']['java_home'] = '/opt/java'
runner.node.override['java']['set_etc_environment'] = true
runner.converge(described_recipe)
end
it 'should create the profile.d directory' do
expect(chef_run).to create_directory('/etc/profile.d')
end
it 'should create /etc/environment with the java home variable' do
expect(chef_run).to run_ruby_block('Set JAVA_HOME in /etc/environment')
end
end
end