We have a development database that has quite a few non-Rails convention
names for tables and fields.  Also we have quite a few primary-foreign
key relationships.  This database has been inherited from a legacy
system.  However, when we run the rspec then Rails runs a
db:test:prepare that loads the system-generated schema.rb file.
However, the schema.rb file doesn't seem to play well with this legacy
database and doesn't translate some things well.  So the schema.rb
generated transforms some fields from varchar to number, etc.

So in order to build the test database properly, I have made a few edits
to the rspec.rake to run a db:test:purge and then a db:migrate to build
the database structure from development.  This is a bit of a hack and I
don't like it.  What's a better way?

If I need to give you more details, I would be glad to.

Using JRuby 1.5.6
Oracle Enhanced Driver
Rails 2.3.11

I'm calling these two lines directly in the rspec.rake.

Rake::Task['db:test:purge'].invoke
Rake::Task['db:migrate'].invoke('RAILS_ENV=test')

I'd be the last person to say that this is a great way of doing things.

Thanks for any help,

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to