spec/mongoid/relations/touchable_spec.rb in mongoid-4.0.0.alpha1 vs spec/mongoid/relations/touchable_spec.rb in mongoid-4.0.0.alpha2
- old
+ new
@@ -267,9 +267,26 @@
it "updates the parent's updated at" do
expect(agency.updated_at).to_not eq(updated)
end
end
+ context "when modifying the child" do
+
+ let!(:agency) do
+ Agency.create
+ end
+
+ let!(:agent) do
+ agency.agents.create(number: '1')
+ end
+
+ it "updates the parent's updated at" do
+ expect {
+ agent.update_attributes(number: '2')
+ }.to change { agency.updated_at }
+ end
+ end
+
context "when destroying the child" do
let!(:agency) do
Agency.create
end