Sha256: bb4f1a2033a59fec21d89fbbe9420e2d05c3ad31a14328970e30566885f8dd46

Contents?: true

Size: 610 Bytes

Versions: 3

Compression:

Stored size: 610 Bytes

Contents

require 'spec_helper'

RSpec.describe Grape::App::Middleware::ConnectionManagement do
  include Rack::Test::Methods

  let :app do
    failing = ->(_) { raise(ActiveRecord::StatementInvalid) }
    middleware = described_class
    Rack::Builder.new do
      use middleware
      run failing
    end
  end

  it 'clears active connections' do
    ActiveRecord::Base.connection
    expect(ActiveRecord::Base.connection_handler).to be_active_connections

    expect { get '/' }.to raise_error(ActiveRecord::StatementInvalid)
    expect(ActiveRecord::Base.connection_handler).not_to be_active_connections
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-app-0.10.0 spec/grape/app/middleware/connection_management_spec.rb
grape-app-0.9.0 spec/grape/app/middleware/connection_management_spec.rb
grape-app-0.8.8 spec/grape/app/middleware/connection_management_spec.rb