Debian Codegraph @

spec/unit/provider/magnum_config/openstackconfig_spec.rb

raw
1 require 'spec_helper'
2 provider_class = Puppet::Type.type(:magnum_config).provider(:openstackconfig)
3 describe provider_class do
4
5 it 'should default to the default setting when no other one is specified' do
6 resource = Puppet::Type::Magnum_config.new(
7 {:name => 'DEFAULT/foo', :value => 'bar'}
8 )
9 provider = provider_class.new(resource)
10 expect(provider.section).to eq('DEFAULT')
11 expect(provider.setting).to eq('foo')
12 end
13
14 it 'should allow setting to be set explicitly' do
15 resource = Puppet::Type::Magnum_config.new(
16 {:name => 'dude/foo', :value => 'bar'}
17 )
18 provider = provider_class.new(resource)
19 expect(provider.section).to eq('dude')
20 expect(provider.setting).to eq('foo')
21 end
22
23 it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
24 resource = Puppet::Type::Magnum_config.new(
25 {:name => 'dude/foo', :value => '<SERVICE DEFAULT>'}
26 )
27 provider = provider_class.new(resource)
28 provider.exists?
29 expect(resource[:ensure]).to eq :absent
30 end
31
32 it 'should ensure absent when value matches ensure_absent_val' do
33 resource = Puppet::Type::Magnum_config.new(
34 {:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
35 )
36 provider = provider_class.new(resource)
37 provider.exists?
38 expect(resource[:ensure]).to eq :absent
39 end
40
41 end