Sha256: 22154314e84b71cb05a4f835a5d99fef53360dc5f777b151ae75ad227911d538

Contents?: true

Size: 818 Bytes

Versions: 5

Compression:

Stored size: 818 Bytes

Contents

require 'spec_helper'

describe Keymap::ConnectionAdapters::ConnectionPool do
  before do
    @adapter = Keymap::ConnectionAdapters::AbstractAdapter.new nil, nil
    @pool = Keymap::ConnectionAdapters::ConnectionPool.new(Keymap::Base::ConnectionSpecification.new({}, nil))
    @pool.connections << @adapter
    @adapter.pool = @pool
  end

  context "a pool manages connections" do
    it "marks the connections in use when checked out" do
      @adapter.should eq(@pool.connection)
      @adapter.in_use?.should be_true
    end
    it "marks the connection not in use when checked in" do
      @adapter.close
      !@adapter.in_use?.should be_false
    end
    it "returns the same connection upon subsequent checkouts if only one connection is pooled" do
      @adapter.should eq(@pool.connection)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
keymap-0.3.2 spec/functional/abstract_adapter_spec.rb
keymap-0.3.1 spec/functional/abstract_adapter_spec.rb
keymap-0.3.0 spec/functional/abstract_adapter_spec.rb
keymap-0.2.0 spec/functional/abstract_adapter_spec.rb
keymap-0.1.0 spec/functional/abstract_adapter_spec.rb