You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
572 B

  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