summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-04-08 19:45:59 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-04-25 01:19:51 +1000
commita0c1edec69c7eea70fe1ca9f4e0e1dc6fc3d688b (patch)
treeee237f8e09edb2ce697646ff11659c63c979a831 /spec/unit
parent284cbeb6a6b4b8d633890139b8e5c5319f67bde3 (diff)
downloadpuppet-a0c1edec69c7eea70fe1ca9f4e0e1dc6fc3d688b.tar.gz
puppet-a0c1edec69c7eea70fe1ca9f4e0e1dc6fc3d688b.tar.xz
puppet-a0c1edec69c7eea70fe1ca9f4e0e1dc6fc3d688b.zip
Modifying the Settings#handlearg prototype
I'd made the argument no longer optional because I thought the method was rarely used, but it's used in puppetd a good bit. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/util/settings.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index 6f92fae46..0bf2dbb19 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -90,6 +90,20 @@ describe Puppet::Util::Settings do
@settings[:bool].should == true
end
+ it "should consider a cli setting with no argument to be a boolean" do
+ # Turn it off first
+ @settings[:bool] = false
+ @settings.handlearg("--bool")
+ @settings[:bool].should == true
+ end
+
+ it "should consider a cli setting with an empty string as an argument to be a boolean" do
+ # Turn it off first
+ @settings[:bool] = false
+ @settings.handlearg("--bool", "")
+ @settings[:bool].should == true
+ end
+
it "should clear the cache when setting getopt-specific values" do
@settings.setdefaults :mysection, :one => ["whah", "yay"], :two => ["$one yay", "bah"]
@settings[:two].should == "whah yay"