Sha256: df36f510dbcf6001973497dad82bc349121ad46e332a96bc3c775de26e84ae43

Contents?: true

Size: 731 Bytes

Versions: 74

Compression:

Stored size: 731 Bytes

Contents

require 'action_subscriber/middleware/active_record/connection_management'

describe ActionSubscriber::Middleware::ActiveRecord::ConnectionManagement do
  include_context 'action subscriber middleware env'

  before {
    pool = double("pool")
    allow(pool).to receive(:with_connection).and_yield
    allow(ActiveRecord::Base).to receive(:clear_active_connections!)
    allow(ActiveRecord::Base).to receive(:connection_pool).and_return(pool)
  }

  subject { described_class.new(app) }

  it_behaves_like 'an action subscriber middleware'

  it "starts async task to clear connections" do
    expect(ActionSubscriber::Middleware::ActiveRecord::ConnectionManagement).to receive(:start_timed_task!)
    subject.call(env)
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
action_subscriber-5.3.3-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.3 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.2-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.2 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.1-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.1 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.1.pre-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.1.pre spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.0-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.3.0 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.4-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.4 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.3-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.3 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.2-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.2 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.1-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.1 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.0-java spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
action_subscriber-5.2.0 spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb