Sha256: 8bc3342f4af051257164087322ba53c95a67631feac4f683f0e23116f10937b5

Contents?: true

Size: 455 Bytes

Versions: 2

Compression:

Stored size: 455 Bytes

Contents

require File.join(File.dirname(__FILE__), "/../../../../spec_helper.rb")

describe Mongoid::Extensions::Integer::Conversions do

  describe "#cast" do

    context "when string is a number" do

      it "converts the string to an Integer" do
        Integer.cast("32").should == 32
      end

    end

    context "when string is not a number" do

      it "returns the string" do
        Integer.cast("foo").should == "foo"
      end

    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-0.5.5 spec/unit/mongoid/extensions/integer/conversions_spec.rb
mongoid-0.5.4 spec/unit/mongoid/extensions/integer/conversions_spec.rb