From a0c1edec69c7eea70fe1ca9f4e0e1dc6fc3d688b Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 8 Apr 2009 19:45:59 -0500 Subject: 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 --- spec/unit/util/settings.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec') 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" -- cgit