How do I run the Rails test suite on Edge?

Wes Gamble wrote:

I want to submit a patch for Rails.

I have checked out from the trunk.

I have created what I assume is the test database based on contents of


1) I'm not sure how to actually attempt to run the tests. Where do I
configure the DB connection to point to my test database?

If you go into the activerecord directory, there's a file called
RUNNING_UNIT_TESTS. In there, it says:

== Creating the test database

The default names for the test databases are "activerecord_unittest"
"activerecord_unittest2". If you want to use another database name then
be sure
to update the connection adapter setups you want to test with in
test/connections/<your database>/connection.rb.
When you have the database online, you can import the fixture tables
the test/fixtures/db_definitions/*.sql files.

Assuming you're running MySQL, this means that you have to create two
new databases called 'activerecord_unittest' and
'activerecord_unittest2'. Then, import the starting structure/data in
from the provided SQL files using commands like:

mysql -u root -p activerecord_unittest <
mysql -u root -p activerecord_unittest2 <

If you look in the connections.rb file in
test/connections/native_mysql/connection.rb, you'll see that it is set
up by default to use a user 'rails' with no password. So make a user
'rails' with no password and grant it permissions on the two new

2) How do I actually run the tests?

Again, in RUNNING_UNIT_TESTS, it says:

The easiest way to run the unit tests is through Rake. The default task
the entire test suite for all the adapters. You can also run the suite
on just
one adapter by using the tasks test_mysql_ruby, test_ruby_mysql,
or test_postgresql. For more information, checkout the full array of
rake tasks with "rake -T"

So to run the tests using the MySQL adapter, just run

rake test_mysql

Hope that helps.