aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2013-04-12 11:10:45 +0200
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2013-04-12 11:10:45 +0200
commitb35e1322d0a791ab22cb2c385ec913492c75026d (patch)
tree74cc5d0be13ef9110665741de1a873f84e98e9bd /spec
parent558df46dc9bec98c6c90719d9aed11ec7a338411 (diff)
downloadpuppet-dhcp-b35e1322d0a791ab22cb2c385ec913492c75026d.tar.gz
puppet-dhcp-b35e1322d0a791ab22cb2c385ec913492c75026d.tar.bz2
Rename dhcp::shared-network to dhcp::shared_network, add specs
Diffstat (limited to 'spec')
-rw-r--r--spec/defines/dhcp_shared_network_spec.rb71
1 files changed, 71 insertions, 0 deletions
diff --git a/spec/defines/dhcp_shared_network_spec.rb b/spec/defines/dhcp_shared_network_spec.rb
new file mode 100644
index 0000000..ff5a2c5
--- /dev/null
+++ b/spec/defines/dhcp_shared_network_spec.rb
@@ -0,0 +1,71 @@
+require 'spec_helper'
+
+describe 'dhcp::shared_network' do
+ let (:title) { 'My network' }
+ let (:facts) { {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistcodename => 'squeeze'
+ } }
+
+ context 'when passing wrong value for ensure' do
+ let (:params) { {
+ :ensure => 'running',
+ } }
+
+ it 'should fail' do
+ expect {
+ should contain_concat__fragment('dhcp-shared-My network')
+ }.to raise_error(Puppet::Error, /\$ensure must be either 'present' or 'absent', got 'running'/)
+ end
+ end
+
+ context 'when passing wrong type for subnets' do
+ let (:params) { {
+ :subnets => true,
+ } }
+
+ it 'should fail' do
+ expect {
+ should contain_concat__fragment('dhcp-shared-My network')
+ }.to raise_error(Puppet::Error, /true is not an Array\./)
+ end
+ end
+
+ context 'when passing no parameters' do
+ it { should contain_concat__fragment('dhcp-shared-My network').with(
+ :ensure => 'present',
+ :target => '/etc/dhcp/dhcpd.conf'
+ ).with_content(
+ /shared-network My network/
+ )
+ }
+ end
+
+ context 'when passing wrong type for a subnet' do
+ let (:params) { {
+ :subnets => [true],
+ } }
+
+ it 'should fail' do
+ expect {
+ should contain_concat__fragment('dhcp-shared-My network')
+ }.to raise_error(Puppet::Error, /true is not a string\./)
+ end
+ end
+
+ context 'when passing wrong value for a subnet' do
+ let (:params) { {
+ :subnets => ['wrong value'],
+ } }
+
+ it 'should fail' do
+ expect {
+ should contain_concat__fragment('dhcp-shared-My network')
+ }.to raise_error(Puppet::Error, /"wrong value" does not match/)
+ end
+ end
+
+ context 'when passing subnets' do
+ end
+end