1
0

shared_connection_pool_spec.rb 572 B

12345678910111213141516171819202122232425262728
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe ConnectionPool::SharedConnectionPool do
  4. class MiniConnection
  5. attr_reader :site
  6. def initialize(site)
  7. @site = site
  8. end
  9. end
  10. subject { described_class.new(size: 5, timeout: 5) { |site| MiniConnection.new(site) } }
  11. describe '#with' do
  12. it 'runs a block with a connection' do
  13. block_run = false
  14. subject.with('foo') do |connection|
  15. expect(connection).to be_a MiniConnection
  16. block_run = true
  17. end
  18. expect(block_run).to be true
  19. end
  20. end
  21. end