diff options
author | Steve Huff <shuff@vecna.org> | 2013-03-29 10:04:05 -0400 |
---|---|---|
committer | Steve Huff <shuff@vecna.org> | 2013-03-29 12:53:56 -0400 |
commit | e6916f83fd35989db4b86dfb10716c9198994389 (patch) | |
tree | d0377c4e8abaf579ccfba824a762e3cbcf3f96bc /spec/unit | |
parent | 4078a6ff44c3ea8c2a071eec3bd7b02dabc770d7 (diff) | |
download | puppet-stdlib-e6916f83fd35989db4b86dfb10716c9198994389.tar.gz puppet-stdlib-e6916f83fd35989db4b86dfb10716c9198994389.tar.bz2 |
Enable num2bool to accept numeric input
Also ignore rspec fixtures directory
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/puppet/parser/functions/num2bool_spec.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/unit/puppet/parser/functions/num2bool_spec.rb b/spec/unit/puppet/parser/functions/num2bool_spec.rb index 640c689..e51ee45 100644 --- a/spec/unit/puppet/parser/functions/num2bool_spec.rb +++ b/spec/unit/puppet/parser/functions/num2bool_spec.rb @@ -12,13 +12,33 @@ describe "the num2bool function" do lambda { scope.function_num2bool([]) }.should( raise_error(Puppet::ParseError)) end - it "should return true if 1" do + it "should return true if passed string 1" do result = scope.function_num2bool(["1"]) result.should(be_true) end - it "should return false if 0" do + it "should return true if passed number 1" do + result = scope.function_num2bool([1]) + result.should(be_true) + end + + it "should return false if passed string 0" do result = scope.function_num2bool(["0"]) result.should(be_false) end + + it "should return false if passed number 0" do + result = scope.function_num2bool([0]) + result.should(be_false) + end + + it "should return false if passed string -1" do + result = scope.function_num2bool(["-1"]) + result.should(be_false) + end + + it "should return false if passed number -1" do + result = scope.function_num2bool([-1]) + result.should(be_false) + end end |