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

Russell Fine lists at ruby-forum.com
Sun Mar 7 11:11:15 EST 2010

David Chelimsky wrote:
> 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
>   end
> end
> HTH,
> David

Thanks for the quick reply.  Do you happen to know where in the 
framework I would call to clear out the db?  I can obviously do it 
myself by hand by just deleting all elements, but I'm worried that the 
testing framework may perform some unique actions that differ from what 
I would do.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list