Sha256: 433eac0f040003b5e244a583a720c77295b2f56f19eb7602f2c7e5a01e01d983

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

require 'spec_helper'
require 'logger'

describe "ActiveRecord Extensions" do
  it "reloads connection pools when establishing a new connection" do
    Octoshark.configure(configs)

    spec = ActiveRecord::Base.remove_connection
    ActiveRecord::Base.establish_connection(spec)

    expect(ActiveRecord::Base.connection_pool).to eq(Octoshark.find_connection_pool(:default))
  end

  it "logs current connection name" do
    io = StringIO.new
    logger = Logger.new(io)

    ActiveRecord::Base.logger = logger

    Octoshark.configure(configs)
    Octoshark.with_connection(:db1) do |connection|
      connection.execute("SELECT 1")
    end

    expect(io.string).to include('[Octoshark: db1]')

    ActiveRecord::Base.logger = nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octoshark-0.0.5 spec/octoshark/active_record_extensions_spec.rb
octoshark-0.0.4 spec/octoshark/active_record_extensions_spec.rb