Sha256: a80cbc0575afdb693eb0c8552f2d20825cdce9dc2b8e7b829a0aa798523c9861
Contents?: true
Size: 851 Bytes
Versions: 1
Compression:
Stored size: 851 Bytes
Contents
require 'test_helper' class MongoIDTest < Test::Unit::TestCase PhonyError = Class.new(StandardError) class Phony def to_s raise PhonyError end end context "mm_typecast" do should "return value if object id" do id = XGen::Mongo::Driver::ObjectID.new MongoID.mm_typecast(id).should == id end should "return object id if string" do id = XGen::Mongo::Driver::ObjectID.new MongoID.mm_typecast(id.to_s).should == id end should "raise MongoMapper::IllegalID if invalid id" do lambda { MongoID.mm_typecast(1234) }.should raise_error(MongoMapper::IllegalID) end should "raise exception if message does not match illegal object id" do lambda { MongoID.mm_typecast(Phony.new) }.should raise_error(PhonyError) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jnunemaker-mongomapper-0.3.2 | test/unit/test_mongo_id.rb |