diff options
author | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-04-11 14:25:15 +0200 |
---|---|---|
committer | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-04-11 14:25:15 +0200 |
commit | 65bea20e0d8e61de7519bb1ab0677597500aaac7 (patch) | |
tree | 89a91f68d8118bc56dbf7da3afe652de3a565dfd /spec | |
parent | a3158aaca4070a4de89b49d687854d72df8741fe (diff) | |
download | puppet-dhcp-65bea20e0d8e61de7519bb1ab0677597500aaac7.tar.gz puppet-dhcp-65bea20e0d8e61de7519bb1ab0677597500aaac7.tar.bz2 |
Get rid of unscoped variables in dhcp::server, fix template
Diffstat (limited to 'spec')
-rw-r--r-- | spec/classes/dhcp_spec.rb | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/spec/classes/dhcp_spec.rb b/spec/classes/dhcp_spec.rb index c833c52..ce9228e 100644 --- a/spec/classes/dhcp_spec.rb +++ b/spec/classes/dhcp_spec.rb @@ -34,6 +34,13 @@ describe 'dhcp' do :mode => '0644' ) } + it { should contain_concat__fragment('00.dhcp.server.base').with( + :ensure => 'present', + :target => '/etc/dhcp3/dhcpd.conf', + :content => /log-facility/ + ).with_content(/ddns-update-style none;/).with_content(/#authoritative/) + } + # Service it { should contain_service('dhcpd').with( :ensure => 'running', @@ -62,6 +69,13 @@ describe 'dhcp' do :mode => '0644' ) } + it { should contain_concat__fragment('00.dhcp.server.base').with( + :ensure => 'present', + :target => '/etc/dhcp/dhcpd.conf', + :content => /log-facility/ + ).with_content(/ddns-update-style none;/).with_content(/#authoritative/) + } + # Service it { should contain_service('dhcpd').with( :ensure => 'running', @@ -70,4 +84,58 @@ describe 'dhcp' do :pattern => '/usr/sbin/dhcpd' ) } end + + context 'When passing ddns_update' do + let (:facts) { { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :lsbdistcodename => 'squeeze' + } } + let (:params) { { + :server_ddns_update => 'foo' + } } + + it { should contain_concat__fragment('00.dhcp.server.base').with( + :ensure => 'present', + :target => '/etc/dhcp/dhcpd.conf', + :content => /log-facility/ + ).with_content(/ddns-update-style foo;/).with_content(/#authoritative/) + } + end + + context 'When passing authoritative' do + let (:facts) { { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :lsbdistcodename => 'squeeze' + } } + let (:params) { { + :server_authoritative => true + } } + + it { should contain_concat__fragment('00.dhcp.server.base').with( + :ensure => 'present', + :target => '/etc/dhcp/dhcpd.conf', + :content => /log-facility/ + ).with_content(/ddns-update-style none;/).with_content(/[^#]authoritative/) + } + end + + context 'When passing opts' do + let (:facts) { { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :lsbdistcodename => 'squeeze' + } } + let (:params) { { + :server_opts => ['foo', 'bar', 'baz'] + } } + + it { should contain_concat__fragment('00.dhcp.server.base').with( + :ensure => 'present', + :target => '/etc/dhcp/dhcpd.conf', + :content => /log-facility/ + ).with_content(/ddns-update-style none;/).with_content(/#authoritative/).with_content(/foo;\nbar;\nbaz;\n/) + } + end end |