Sha256: edd8eaff3aa3b095941b2a6f0f5e2b75579595e70cbbe443039ae0f9cd470ed2
Contents?: true
Size: 970 Bytes
Versions: 12
Compression:
Stored size: 970 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", "blood_alcohol_content" => 0.0 } 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", "blood_alcohol_content" => 0.0 } @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
12 entries across 12 versions & 2 rubygems