[rspec-users] How to test an app with multiple databases?

David Chelimsky dchelimsky at gmail.com
Sun Mar 7 10:50:13 EST 2010

On Sun, Mar 7, 2010 at 9:45 AM, Russell Fine <lists at ruby-forum.com> wrote:
> Our app connects to two databases.  The main database (through
> ActiveRecord::Base) is automatically cleared before each test.  How do I
> force the clear of the secondary database as well ?

There's no implicit support for this, so you'd have to do something
manually in a before(:each) block. You can do that in the
configuration (usually in spec_helper):

Spec::Runner.configure do |c|
  c.before(:each) do
    # clear out 2ndary db


More information about the rspec-users mailing list