Marko Anastasov wrote this on February 19, 2009
Preparing the test database for Rails
Ryan Bates has [covered]](http://railscasts.com/episodes/113)how to contribute to Rails with Git. Since Rails is on GitHub, the basic workflow goes pretty much as you’d expect if you’re familiar with git.
If you want to file a bug for ActiveRecord for example, it’s most helpful to provide or extend an existing test case. See file RUNNING_UNIT_TESTS
in the activerecord directory. Here’s how you prepare a MySQL test database:
create database activerecord_unittest; create database activerecord_unittest2; grant all on activerecord_unittest.* TO rails@localhost; grant all on activerecord_unittest2.* TO rails@localhost;
These tests use a number of models, defined in activerecord/test/models/. Running
rake test_mysql TEST=test/cases/aaa_create_tables_test.rb
creates the tables defined in schema.rb. After that you can run tests by specifying the db adapter, like
rake test_mysql TEST=test/cases/base_test.rb