Marko Anastasov wrote this on February 19, 2009

Preparing the test database for Rails

Ryan Bates has [covered]]( 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
comments powered by Disqus

About Marko Anastasov

Marko co-founded Rendered Text. He’s a programmer with a passion of creating something for other people, coupled with interests in how things work in the society and nature. He is having a great time working across many areas in the company, including product design, helping the engineering teams, empowering users and marketing. He likes to counterbalance it all with running, cycling or a day in the woods.

Suggested Reads

Inject is a fundamental building block

Inject is one of the fundamental, and most versatile constructs available in functional languages. It can be used to implement map, select, max, all? and a bunch of other iteration related methods. Unfortunately, many programmers are not aware of its awesome powers. This article is here to improve this fact.


Rendered Text is a software company. For questions regarding Semaphore, please visit Otherwise, feel free to get in touch any time by sending us an email.

Rendered Text
Svetozara Miletica 10
21000 Novi Sad