test/test_canhaz.rb in rails-canhaz-0.2.0 vs test/test_canhaz.rb in rails-canhaz-0.3.0

- old
+ new

@@ -214,7 +214,39 @@ assert result[s1.id] == [o2] assert result[s2.id] == [o1] end + def test_destroy + s = SubjectModel.new + o = ObjectModel.new + + s.save + o.save + + id = s.id + + s.can(:foo, o) + s.can(:bar, o) + + s.destroy + + assert CanHazPermission.find_by_csubject_id(id).nil? + + s = SubjectModel.new + o = ObjectModel.new + + s.save + o.save + + id = o.id + + s.can(:foo, o) + s.can(:bar, o) + + o.destroy + + assert CanHazPermission.find_by_cobject_id(id).nil? + end + end