From 6a43e85e09a6fd7904c4e11e4df132aa24c6c287 Mon Sep 17 00:00:00 2001 From: Todd Eddy <vr@vrillusions.com> Date: Wed, 14 Aug 2013 13:34:07 -0400 Subject: [PATCH] Update tests. --- manifests/config.pp | 2 ++ spec/defines/postfix_config_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 4252539..d623ff6 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -34,6 +34,8 @@ define postfix::config ($value = undef, $ensure = 'present') { "\$ensure must be either 'present', 'absent' or 'blank', got '${ensure}'") if ($ensure == 'present') { validate_string($value) + validate_re($value, '^.+$', + '$value can not be empty if ensure = present') } if (!defined(Class['postfix'])) { diff --git a/spec/defines/postfix_config_spec.rb b/spec/defines/postfix_config_spec.rb index d166f10..886f8b0 100644 --- a/spec/defines/postfix_config_spec.rb +++ b/spec/defines/postfix_config_spec.rb @@ -11,7 +11,7 @@ describe 'postfix::config' do it 'should fail' do expect { should contain_augeas("set postfix 'foo'") - }.to raise_error(Puppet::Error, /Must pass value to Postfix::Config/) + }.to raise_error(Puppet::Error, /value can not be empty/) end end @@ -46,7 +46,7 @@ describe 'postfix::config' do it 'should fail' do expect { should contain_augeas("set postfix 'foo'") - }.to raise_error(Puppet::Error, /must be either 'present' or 'absent'/) + }.to raise_error(Puppet::Error, /must be either 'present', 'absent' or 'blank'/) end end -- GitLab