summaryrefslogtreecommitdiff
path: root/spec/functions/bool2num_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functions/bool2num_spec.rb')
-rwxr-xr-xspec/functions/bool2num_spec.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/functions/bool2num_spec.rb b/spec/functions/bool2num_spec.rb
index fbf461b..3904d7e 100755
--- a/spec/functions/bool2num_spec.rb
+++ b/spec/functions/bool2num_spec.rb
@@ -17,8 +17,22 @@ describe "the bool2num function" do
expect(result).to(eq(1))
end
- it "should convert false to 0" do
- result = scope.function_bool2num([false])
+ it "should convert 'true' to 1" do
+ result = scope.function_bool2num(['true'])
+ result.should(eq(1))
+ end
+
+ it "should convert 'false' to 0" do
+ result = scope.function_bool2num(['false'])
expect(result).to(eq(0))
end
+
+ it "should accept objects which extend String" do
+ class AlsoString < String
+ end
+
+ value = AlsoString.new('true')
+ result = scope.function_bool2num([value])
+ result.should(eq(1))
+ end
end