test/functional/test_protected.rb in mongo_mapper-0.10.0 vs test/functional/test_protected.rb in mongo_mapper-0.10.1
- old
+ new
@@ -62,17 +62,33 @@
doc = @doc_class.first(:name => 'John')
doc.admin.should be_true
doc.name.should == 'John'
end
+ should "not ignore protected attributes on #reload" do
+ doc = @doc_class.new(:name => 'John')
+ doc.admin = true
+ doc.save!
+
+ doc.reload
+ doc.admin.should be_true
+ doc.name.should == 'John'
+ end
+
should "ignore protected attribute on #update_attributes" do
@doc.update_attributes(:name => 'Ren Hoek', :admin => true)
@doc.name.should == 'Ren Hoek'
@doc.admin.should be_false
end
should "ignore protected attribute on #update_attributes!" do
@doc.update_attributes!(:name => 'Stimpson J. Cat', :admin => true)
+ @doc.name.should == 'Stimpson J. Cat'
+ @doc.admin.should be_false
+ end
+
+ should "ignore protecteds attribute on #attributes=" do
+ @doc.attributes = {:name => 'Stimpson J. Cat', :admin => true}
@doc.name.should == 'Stimpson J. Cat'
@doc.admin.should be_false
end
should "be indifferent to whether the protected keys are strings or symbols" do