janko-m/sinatra-activerecord — pull request #23 by atombender (2014-03-03 19:56:07+00:00)
Title: Add db:test:prepare

This emulates the Railtie implementation, so that you can do `rake db:test:prepare`, and it will use the `test` environment to purge and load the schema into the test database, exactly the same way as with Rails apps. This makes it easier to treat Sinatra apps just like Rails app when it comes to both local and CI testing.

I found writing the test a bit awkward as the tests really exercise the Rake task _module_, not the Rake tasks themselves, contrary to the descriptions, and there are some assumptions — specifically, that `ActiveRecord::Base.configurations` was not populated in the tests — that I had to fight against.