Re: PostgreSQL 8.1, testing with constraints

On Nov 30, 2005, at 10:40 AM, [email protected] wrote:

without the foreign key constraints, they run fine, but blow up when I
active_record/connection_adapters/abstract_adapter.rb:67:in
`log’: ERROR: relation “users” already exists
(ActiveRecord::StatementInvalid)

I assume that it’s not able to drop the users table because of a
foreign key constraint in the messages table. I’m not using the
messages fixture in these unit tests though, so it shouldn’t matter.

I want to use foreign key constraints in my database, but I also want
to be able to unit test my code. What am I missing here?

http://dev.rubyonrails.org/ticket/2404


Eric H. - [email protected] - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 30, 2005, at 11:25 AM, Pat M. wrote:

I only specify the
users and the tickets fixtures, but it complains that some record in
the messages table references a user record. There shouldn’t be any
messages records though, so I’m just confused.

This is the same issue covered in ticket #2404 which Eric linked to.

jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDjf7pAQHALep9HFYRAsvAAJ9x098LIJXK4B5JCl4NmbzMMSuKYACeKISW
VVXLCWDuMdeqBeF+9jrrKws=
=k5CY
-----END PGP SIGNATURE-----

I actually figured out the answer to this problem, it was because of a
custom test_helper.rb file in the LoginEngine. However as I mentioned
in a reply, one of my unit tests is complaining about a fixture that
shouldn’t even be loaded in that particular file. I only specify the
users and the tickets fixtures, but it complains that some record in
the messages table references a user record. There shouldn’t be any
messages records though, so I’m just confused.