Skip to content

Rails Unit Tests Failing. What could it be?

February 26, 2007

If you are using the a table prefix in your environment.rb you may be heading towards trouble with Unit Tests.

in my case I had

config.active_record.table_name_prefix = "fd_"

after raking the database migrations the tables were created correctly with the “fd_” prefix, but when I ran rake db:test:prepare the tables were created with a double prefix!

If table in the development database is prefix_table, after the rake db:test:prepare it will be created as prefix_prefix_table, and all your tests will fail no matter what.
The same thing is reported to happen with rake db:test:clone. All tables are created with a duplicate prefix in the test database.

I searched the Rails Trac and found this problem and already been reported and fixed, so if you need the patch, please get it here

If you search the Tickets you’ll find out as slew of table_name_prefix problems so for now I am staying away from them.

Advertisements

From → Ruby on Rails

2 Comments
  1. I would like to see a continuation of the topic

  2. Dat Chu permalink

    Thanks for the information on table_name_prefix. I am running into some problem with using reserved keywords of SQL and looked to table_name_prefix as a quick fix. Do you happen to know if this bug has been fixed?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: