Unit test preperation with migrations

I have spent sometime this afternoon learning how to unit test rails
applications and integrate the Cerberus CI tool. One key area confuses
me however, and I would appreciate other peoples views of how best to
overcome the issue.

My understanding is that the ‘test’ and ‘test:units’ have the
db:test:prepare pre-requisite which copies the schema from dev to the
test database. I would prefer to use migrations to perform the building
of the test schema, and I have tried
http://snippets.dzone.com/posts/show/2031’ to use migration building.
However, this still attempts to use ‘dropdb’ and ‘createdb’ commands
when using the rake test. I know this is some kind of setup /
registration problem, but I wanted confirmation that these kind of
‘tweaks’ to the rails app is the best way of implementing the migration
control over the test db.

What are your thoughts and apologies if there are similar posts on this
topic, but I have spent some time searching!!!

Hi –

On Sun, 16 Dec 2007, Paul Williams wrote:

http://snippets.dzone.com/posts/show/2031’ to use migration building.
However, this still attempts to use ‘dropdb’ and ‘createdb’ commands
when using the rake test. I know this is some kind of setup /
registration problem, but I wanted confirmation that these kind of
‘tweaks’ to the rails app is the best way of implementing the migration
control over the test db.

What are your thoughts and apologies if there are similar posts on this
topic, but I have spent some time searching!!!

I’m probably guilty of taking a very unsophisticated approach but what
I normally do is:

rake db:migrate RAILS_ENV=test

David


Training for 2008!
Ruby on Rails training by David A. Black/Ruby Power and Light, LLC:
* Intro to Rails, New York, NY, February 4-7 2008
* Advancing With Rails, New York, NY, February 11-14 2008
Hosted by Exceed Education. See http://www.rubypal.com for details!