If you’re using Postgresql with Rails 2.2, your testing database user needs to be a “superuser” for your tests to run. This is not a good thing. It’s the equivalent of running as root. But, if you’ve got a completely separate development/testing server it’s better than not being able to test at all.
If your postgres testing user isn’t a superuser, you’ll get errors like:
ActiveRecord::StatementInvalid: PGError: ERROR: permission \ denied: "RI_ConstraintTrigger_17866" is a system trigger
You can create a postgres superuser thusly:
> su - postgres > psql template1 > template1=# create user your username superuser;
Update the testing stanza of your config/database.yml and you should be good to go.