Rails doesn’t delete loaded fixtures in the tear down phase of tests, but it does delete and re-insert the fixtures you do use at the beginning of tests. This is a serious problem if you use foreign keys.
This issue is covered in the Rails issue tracker here: http://dev.rubyonrails.org/ticket/2404
Continue reading “First Rails gotcha: Rails doesn’t tear down fixture data”