spec/unit/mongoid/attributes_spec.rb in mongoid-0.6.7 vs spec/unit/mongoid/attributes_spec.rb in mongoid-0.6.8
- old
+ new
@@ -24,9 +24,26 @@
it "returns a properly cast the attributes" do
attrs = Person.new(@attributes).attributes
attrs[:age].should == 30
attrs[:terms].should == true
+ attrs[:_id].should == "1"
+ end
+
+ end
+
+ context "when associations provided in the attributes" do
+
+ before do
+ @name = Name.new(:first_name => "Testy")
+ @attributes = {
+ :name => @name
+ }
+ @person = Person.new(@attributes)
+ end
+
+ it "sets the associations" do
+ @person.name.should == @name
end
end
end