Sha256: 6a62aecf1177f6d17d24a137a6e7d04b2aad368b8ca8abf7a8e4025b673457fd
Contents?: true
Size: 906 Bytes
Versions: 19
Compression:
Stored size: 906 Bytes
Contents
require "spec_helper" describe Mongoid::Extensions::Object::Conversions do describe "#mongoidize" do it "returns its attributes" do Person.new(:_id => 1, :title => "Sir").mongoidize.should == { "_id" => 1, "title" => "Sir", "age" => 100, "_type" => "Person" } end end describe "#get" do before do @attributes = { :_id => "test", :title => "Sir", :age => 100 } end it "instantiates a new class from the attributes" do Person.get(@attributes).should == Person.new(@attributes) end end describe "#set" do context "when object has attributes" do before do @attributes = { "_id" => "test", "title" => "Sir", "age" => 100, "_type" => "Person" } @person = Person.new(@attributes) end it "converts the object to a hash" do Person.set(@person).should == @attributes end end end end
Version data entries
19 entries across 19 versions & 1 rubygems