summaryrefslogtreecommitdiff
path: root/spec/unit/puppet
diff options
context:
space:
mode:
authorSteve Huff <shuff@vecna.org>2013-04-01 11:44:09 -0400
committerSteve Huff <shuff@vecna.org>2013-04-01 11:44:09 -0400
commitc372f177708df4c844337e9901646b7b84b86cd8 (patch)
treea946ee1edb5862430106b35150d82aef3a61d8fe /spec/unit/puppet
parent8d217f0012fef332642faf485ad187773a95bcc1 (diff)
Cleanup per adrianthebo suggestions
* use Float() to process string arguments * get rid of doubly nested arrays * removing needless ternary operator * improving error message handling
Diffstat (limited to 'spec/unit/puppet')
-rw-r--r--spec/unit/puppet/parser/functions/num2bool_spec.rb36
1 files changed, 10 insertions, 26 deletions
diff --git a/spec/unit/puppet/parser/functions/num2bool_spec.rb b/spec/unit/puppet/parser/functions/num2bool_spec.rb
index 038881f..b56196d 100644
--- a/spec/unit/puppet/parser/functions/num2bool_spec.rb
+++ b/spec/unit/puppet/parser/functions/num2bool_spec.rb
@@ -25,18 +25,13 @@ describe "the num2bool function" do
result.should(be_true)
end
- it "should return true if passed number 1" do
- result = scope.function_num2bool([1])
- result.should(be_true)
- end
-
- it "should return true if passed array with string 1" do
- result = scope.function_num2bool([["1"]])
+ it "should return true if passed string 1.5" do
+ result = scope.function_num2bool(["1.5"])
result.should(be_true)
end
- it "should return true if passed array with number 1" do
- result = scope.function_num2bool([[1]])
+ it "should return true if passed number 1" do
+ result = scope.function_num2bool([1])
result.should(be_true)
end
@@ -50,34 +45,23 @@ describe "the num2bool function" do
result.should(be_false)
end
- it "should return false if passed array with string 0" do
- result = scope.function_num2bool([["0"]])
- result.should(be_false)
- end
-
- it "should return false if passed array with 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])
+ it "should return false if passed string -1.5" do
+ result = scope.function_num2bool(["-1.5"])
result.should(be_false)
end
- it "should return false if passed array with string -1" do
- result = scope.function_num2bool([["-1"]])
+ it "should return false if passed number -1" do
+ result = scope.function_num2bool([-1])
result.should(be_false)
end
- it "should return false if passed array with number -1" do
- result = scope.function_num2bool([[-1]])
+ it "should return false if passed float -1.5" do
+ result = scope.function_num2bool([-1.5])
result.should(be_false)
end
-
end