Sha256: 400beaec3ab21e05bdf86154e635162276ef36b0bb76295a948a5137860193f9

Contents?: true

Size: 695 Bytes

Versions: 7

Compression:

Stored size: 695 Bytes

Contents

module Helpers

  def configs
    {
      db1: { adapter: "sqlite3", database: "tmp/db1.sqlite" },
      db2: { adapter: "sqlite3", database: "tmp/db2.sqlite" }
    }
  end

  def db(connection)
    connection.execute('PRAGMA database_list').
      first['file'].
      split('/').last.
      split('.').first
  end

  def check_connections_clean_up
    Octoshark.configure({})
    switcher = Octoshark.switcher

    Octoshark.with_connection(:default) { |connection| connection.execute("SELECT 1") }
    expect(switcher.connection_pools.map { |_, c| c.connections.count }.sum).to eq(1)

    yield

    expect(switcher.connection_pools.map { |_, c| c.connections.count }.sum).to eq(0)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
octoshark-0.0.9 spec/support/helpers.rb
octoshark-0.0.8 spec/support/helpers.rb
octoshark-0.0.7 spec/support/helpers.rb
octoshark-0.0.6 spec/support/helpers.rb
octoshark-0.0.5 spec/support/helpers.rb
octoshark-0.0.4 spec/support/helpers.rb
octoshark-0.0.3 spec/support/helpers.rb