spec/unit/assocations_spec.rb in couchrest_model-2.0.3 vs spec/unit/assocations_spec.rb in couchrest_model-2.0.4
- old
+ new
@@ -124,10 +124,11 @@
it "should allow ids to be set directly and load entries" do
@invoice.entry_ids = @entries.collect{|i| i.id}
@invoice.entries.length.should eql(3)
@invoice.entries.first.should eql(@entries.first)
+ @invoice.changed?.should be_true
end
it "should ignore blank ids when set directly" do
@invoice.entry_ids = ["", @entries.first.id]
@invoice.entry_ids.length.should be(1)
@@ -169,9 +170,13 @@
@invoice.entries.should be_empty
end
# Account for dirty tracking
describe "dirty tracking" do
+ it "should register changes on replacement" do
+ @invoice.entries = @entries
+ @invoice.changed?.should be_true
+ end
it "should register changes on push" do
@invoice.changed?.should be_false
@invoice.entries << @entries[0]
@invoice.changed?.should be_true
end