diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2009-10-25 23:14:13 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-10-27 10:34:09 +1100 |
commit | 7517572949e4e0efc419f97cf2663588af8b9756 (patch) | |
tree | 2aa8536f3429817b6df428b1b1c789aae92c4a6b /spec | |
parent | febe7074d2188e1133503ebc5eade5403a6e271e (diff) | |
download | puppet-7517572949e4e0efc419f97cf2663588af8b9756.tar.gz puppet-7517572949e4e0efc419f97cf2663588af8b9756.tar.xz puppet-7517572949e4e0efc419f97cf2663588af8b9756.zip |
Bug #1908 cron environment should allow empty vals
Change regexp to allow cron environment => "MAILTO="
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/type/cron.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/unit/type/cron.rb b/spec/unit/type/cron.rb new file mode 100755 index 000000000..6951077e0 --- /dev/null +++ b/spec/unit/type/cron.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") } + +describe Puppet::Type.type(:cron) do + before do + @cron = Puppet::Type.type(:cron).new( :name => "foo" ) + end + + it "it should accept an :environment that looks like a path" do + lambda do + @cron[:environment] = 'PATH=/bin:/usr/bin:/usr/sbin' + end.should_not raise_error + end + + it "should not accept environment variables that do not contain '='" do + lambda do + @cron[:environment] = "INVALID" + end.should raise_error(Puppet::Error) + end + + it "should accept empty environment variables that do not contain '='" do + lambda do + @cron[:environment] = "MAILTO=" + end.should_not raise_error(Puppet::Error) + end + + it "should accept 'absent'" do + lambda do + @cron[:environment] = 'absent' + end.should_not raise_error(Puppet::Error) + end +end |