Skip to content

Commit 277d78f

Browse files
committed
Add unit tests for license content
1 parent 762ecd9 commit 277d78f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

spec/classes/license_spec.rb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,27 @@
66
on_supported_os.each do |os, os_facts|
77
context "on #{os}" do
88
file_uri = 'puppet:///modules/test_module/licenses/test-license'
9+
test_content = 'test-license-content'
910
let(:facts) { os_facts }
10-
let(:params) { { source: file_uri } }
1111

12-
it { is_expected.to compile }
13-
it { is_expected.to contain_class('zend_common::license').with_source(file_uri) }
1412

15-
describe 'creates license file' do
13+
describe 'without params' do
14+
it { is_expected.to compile.and_raise_error(/.*/) }
15+
end
16+
17+
describe 'with Puppet URL for source' do
18+
let(:params) { { source: file_uri } }
19+
it { is_expected.to compile }
20+
it { is_expected.to contain_class('zend_common::license').with_source(file_uri) }
1621
it { is_expected.to contain_file('/opt/zend/zendphp/etc/license').with_source(file_uri) }
1722
end
23+
24+
describe 'with text for content' do
25+
let(:params) { { content: test_content } }
26+
it { is_expected.to compile }
27+
it { is_expected.to contain_class('zend_common::license').with_content(test_content) }
28+
it { is_expected.to contain_file('/opt/zend/zendphp/etc/license').with_content(test_content) }
29+
end
1830
end
1931
end
2032
end

0 commit comments

Comments
 (0)