How To Automigrate the Test Database Using Merb, Datamapper and RSpec

I am creating a small site using Merb, DataMapper and RSpec, all in all a very enjoyable experience. I did however have problem getting the test database to be automigrated when running the specs, as I am used to in Rails.

As Google did not help, I turned to #merb on IRC, and got immediate help.

Two alternatives:

  1. Run rake MERB_ENV=test dm:db:automigrate before running rake specs
  2. Insert DataMapper::Base.auto_migrate! into your spec/spec_helper.rb

Big thanks to topfunky, afrench and jdempsey for the help.

  • del.icio.us
  • Digg
  • DZone
  • Technorati
  • Reddit

Tags: , , , ,

  • ctran

    should be auto_migrate!

  • @ctran:


    Thanks for noticing. I had actually written it correctly, but Markdown treated the underscore as "begin italics" since I did not escape it. Fixed.

  • Seems like you need to make it rake MERB_ENV=test db:automigrate (without the dm:) now.

  • ottobar

    It also looks like it is now DataMapper.auto_migrate!

blog comments powered by Disqus