Peter
Peter

Reputation: 131

Force DataMapper to disconnect from postgresql

I have a test that is creating and destroying a number of databases in postgresql. In order to be able to drop a database I need to tell DataMapper to disconnect. I can't seem to find any documentation on how to do that.

There is a close_connection method on DataMapper::Adapters::PostgresAdapter but it is protected and requires a connection object that I can't seem to get.

Is this even possible?

Upvotes: 2

Views: 309

Answers (1)

Peter
Peter

Reputation: 131

DataObjects::Pooling.pools.each {|pool| pool.dispose} seems to work as long as you have only one connection open at a time.

Upvotes: 3

Related Questions