Sha256: 711a733358d39f81280f3635110c6505f0ea299828eedc2b4e293a0c0895b04e
Contents?: true
Size: 1015 Bytes
Versions: 24
Compression:
Stored size: 1015 Bytes
Contents
require "spec_helper" describe Mongoid::Extensions::Float::Conversions do describe "#set" do context "when the value is a number" do it "converts the number to a float" do Float.set(3.45).should == 3.45 end end context "when the value is not a number" do context "when the value is non numerical" do it "returns the string" do Float.set("foo").should == "foo" end end context "when the string is numerical" do it "returns the float value for the string" do Float.set("3.45").should == 3.45 end end context "when the string is empty" do it "returns 0.0" do Float.set("").should be_nil end end context "when the string is nil" do it "returns 0.0" do Float.set(nil).should be_nil end end end end describe "#get" do it "returns the float" do Float.get(3.45).should == 3.45 end end end
Version data entries
24 entries across 24 versions & 3 rubygems