Sha256: 2ffb12ed16822b4ef7e016bbb13a6e187c16138a12de3f0fc3fcd906373e5178
Contents?: true
Size: 847 Bytes
Versions: 4
Compression:
Stored size: 847 Bytes
Contents
require File.join(File.dirname(__FILE__), "/../../../../spec_helper.rb") 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 } 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 before do @attributes = { "_id" => "test", "title" => "Sir", "age" => 100 } @person = Person.new(@attributes) end it "converts the object to a hash" do Person.set(@person).should == @attributes end end end
Version data entries
4 entries across 4 versions & 1 rubygems