summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-03-03 21:36:56 -0600
committerJames Turnbull <james@lovedthanlost.net>2009-03-05 08:22:10 +1100
commit61661b1c46fafeabf1bdbc4778762831d7178d91 (patch)
tree270f8dcb07cf818435a2f3c0e130d4a3b4436bb7 /spec/unit
parentd5850dc40f20b6ea9429588c476eb0dca2d205b7 (diff)
downloadpuppet-61661b1c46fafeabf1bdbc4778762831d7178d91.tar.gz
puppet-61661b1c46fafeabf1bdbc4778762831d7178d91.tar.xz
puppet-61661b1c46fafeabf1bdbc4778762831d7178d91.zip
Fixing #1991 - ldap booleans get converted to booleans
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/indirector/node/ldap.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/indirector/node/ldap.rb b/spec/unit/indirector/node/ldap.rb
index ed8809e73..d407796c6 100755
--- a/spec/unit/indirector/node/ldap.rb
+++ b/spec/unit/indirector/node/ldap.rb
@@ -91,6 +91,26 @@ describe Puppet::Node::Ldap do
@searcher.entry2hash(@entry)[:parameters]["foo"].should == "one"
end
+ it "should convert 'true' values to the boolean 'true'" do
+ @entry.stubs(:to_hash).returns({"one" => ["true"]})
+ @searcher.entry2hash(@entry)[:parameters]["one"].should == true
+ end
+
+ it "should convert 'false' values to the boolean 'false'" do
+ @entry.stubs(:to_hash).returns({"one" => ["false"]})
+ @searcher.entry2hash(@entry)[:parameters]["one"].should == false
+ end
+
+ it "should convert 'true' values to the boolean 'true' inside an array" do
+ @entry.stubs(:to_hash).returns({"one" => ["true", "other"]})
+ @searcher.entry2hash(@entry)[:parameters]["one"].should == [true, "other"]
+ end
+
+ it "should convert 'false' values to the boolean 'false' inside an array" do
+ @entry.stubs(:to_hash).returns({"one" => ["false", "other"]})
+ @searcher.entry2hash(@entry)[:parameters]["one"].should == [false, "other"]
+ end
+
it "should add the parent's name if present" do
@entry.stubs(:vals).with("parentnode").returns(%w{foo})
@searcher.entry2hash(@entry)[:parent].should == "foo"