2 require 'puppet/type/nova_config'
3 describe 'Puppet::Type.type(:nova_config)' do
5 @nova_config = Puppet::Type.type(:nova_config).new(:name => 'DEFAULT/foo', :value => 'bar')
8 it 'should require a name' do
10 Puppet::Type.type(:nova_config).new({})
11 }.to raise_error(Puppet::Error, 'Title or name must be provided')
14 it 'should not expect a name with whitespace' do
16 Puppet::Type.type(:nova_config).new(:name => 'f oo')
17 }.to raise_error(Puppet::Error, /Parameter name failed/)
20 it 'should fail when there is no section' do
22 Puppet::Type.type(:nova_config).new(:name => 'foo')
23 }.to raise_error(Puppet::Error, /Parameter name failed/)
26 it 'should not require a value when ensure is absent' do
27 Puppet::Type.type(:nova_config).new(:name => 'DEFAULT/foo', :ensure => :absent)
30 it 'should accept a valid value' do
31 @nova_config[:value] = 'bar'
32 @nova_config[:value].should == 'bar'
35 it 'should not accept a value with whitespace' do
36 @nova_config[:value] = 'b ar'
37 @nova_config[:value].should == 'b ar'
40 it 'should accept valid ensure values' do
41 @nova_config[:ensure] = :present
42 @nova_config[:ensure].should == :present
43 @nova_config[:ensure] = :absent
44 @nova_config[:ensure].should == :absent
47 it 'should not accept invalid ensure values' do
49 @nova_config[:ensure] = :latest
50 }.to raise_error(Puppet::Error, /Invalid value/)