Bambinos RSS

New Bamboo

Bamboo Blog

Archive

Nov
4th
Tue
permalink ismasan

Test ActiveRecord schemas

I’m writing a gemified extension to ActiveRecord. I want a SQLite database to create a quick and dirty schema to test my finders. Yes, I’m lazy and can’t be bothered to write mocks. I want to be able to add or remove columns quickly while avoiding SQL (did I mention I’m lazy?)

Solution: create a SQLite file in your test folder, and the following rake task in your gem’s “tasks” directory (see embeded gist)

Use with:

rake db:create

Modify the schema in the migration definition and create again