środa, 24 sierpnia 2011

unit testing and inheritance

In my project I have Single Table Inheritance (STI). Example of STI. type:string is very important!!!

I came across an error while I tried the unit testing:

Problem:
test_the_truth(AdminTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: clients: DELETE FROM "clients" WHERE 1=1

Solution1:
delete the fixtures of chlid models, in this case table 'clients'


Solution2:
add name of the fixtures one want to add in each test:
fixtures :clients
and delete line
fixtures :all
from the test_helper.rb

Brak komentarzy:

Prześlij komentarz