Sha256: d2db8d6b40c9d2fd6869decf5a4eaff7fe8f7135795884da72b92adabde66ff4
Contents?: true
Size: 852 Bytes
Versions: 2
Compression:
Stored size: 852 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 DocumentNotFound if invalid id" do lambda { MongoID.mm_typecast(1234) }.should raise_error(MongoMapper::DocumentNotFound) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jnunemaker-mongomapper-0.3.0 | test/unit/test_mongo_id.rb |
jnunemaker-mongomapper-0.3.1 | test/unit/test_mongo_id.rb |