spec/unit/mongoid/attributes_spec.rb in mongoid-0.11.3 vs spec/unit/mongoid/attributes_spec.rb in mongoid-0.11.4
- old
+ new
@@ -94,11 +94,12 @@
context "when attributes dont have fields defined" do
before do
@attributes = {
:nofieldstring => "Testing",
- :nofieldint => 5
+ :nofieldint => 5,
+ :employer => Employer.new
}
end
context "when allowing dynamic fields" do
@@ -121,9 +122,18 @@
it "adds a properly typed field" do
@person.nofieldint.should == 5
@person.nofieldint = 50
@person.nofieldint.should == 50
+ end
+
+ end
+
+ context "when a method has been defined for the attribute" do
+
+ it "does not create the field" do
+ @person.fields.keys.should_not include("employer")
+ @person.fields.keys.should_not include("employer=")
end
end
end