Debian Codegraph @

spec/unit/type/virtsecretd_config_spec.rb

raw
1 require 'puppet'
2 require 'puppet/type/virtsecretd_config'
3
4 describe 'Puppet::Type.type(:virtsecretd_config)' do
5 before :each do
6 @virtsecretd_config = Puppet::Type.type(:virtsecretd_config).new(:name => 'DEFAULT/foo', :value => 'bar')
7 end
8
9 it 'should accept a valid value' do
10 @virtsecretd_config[:value] = 'bar'
11 expect(@virtsecretd_config[:value]).to eq('bar')
12 end
13
14 it 'should convert a boolean value (true)' do
15 @virtsecretd_config[:value] = true
16 expect(@virtsecretd_config[:value]).to eq('1')
17 end
18
19 it 'should convert a boolean value (false)' do
20 @virtsecretd_config[:value] = false
21 expect(@virtsecretd_config[:value]).to eq('0')
22 end
23
24 it 'should autorequire the package that install the file' do
25 catalog = Puppet::Resource::Catalog.new
26 anchor = Puppet::Type.type(:anchor).new(:name => 'nova::install::end')
27 catalog.add_resource anchor, @virtsecretd_config
28 dependency = @virtsecretd_config.autorequire
29 expect(dependency.size).to eq(1)
30 expect(dependency[0].target).to eq(@virtsecretd_config)
31 expect(dependency[0].source).to eq(anchor)
32 end
33
34 end