# Unit\_tests and deleting from the database

**URL:** <https://www.ruby-forum.com/t/unit-tests-and-deleting-from-the-database/55191>\
**Category:** Rails\
**Created:** [March 17, 2006, 7:10pm UTC](https://www.ruby-forum.com/t/unit-tests-and-deleting-from-the-database/55191 "2006-03-17T19:10:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oom\_Tuinstoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/4491bb/32.png) [@Oom\_Tuinstoel](https://www.ruby-forum.com/u/Oom_Tuinstoel)\
**Post date:** [March 17, 2006, 7:10pm UTC](https://www.ruby-forum.com/t/unit-tests-and-deleting-from-the-database/55191/1 "2006-03-17T19:10:28Z")

</div>

I get errors when running rake test\_units:

test\_destroy(LocationTest):  
ActiveRecord::StatementInvalid: Mysql::Error: #23000Cannot delete or  
update a pa  
rent row: a foreign key constraint fails (`overblijf_tst/groups`,  
CONSTRAINT `fk _groups_locations` FOREIGN KEY (`location_id`) REFERENCES `locations`  
(`id`)): D  
ELETE FROM locations

Any pointers??
