Sha256: 9e64fa07d240b0897133998814869b109a9363ba163c7b5084cdb523c6be8ed6

Contents?: true

Size: 695 Bytes

Versions: 1

Compression:

Stored size: 695 Bytes

Contents

require 'activerecord-exception-adapter'

RSpec.describe ActiveRecordExceptionAdapter do
  before :all do
    require 'active_record'
    ActiveRecord::Base.configurations = {
      'main' => {
        'adapter' => 'exception',
      },
    }
  end

  describe '.establish_connection' do
    it 'succeeds' do
      expect(ActiveRecord::Base.establish_connection(:main)).to be_a(ActiveRecord::ConnectionAdapters::ConnectionPool)
    end
  end

  describe '.connection' do
    it 'raises an exception' do
      ActiveRecord::Base.establish_connection(:main)
      expect { ActiveRecord::Base.connection }.to raise_error(ActiveRecord::ConnectionAdapters::ExceptionAdapter::Error)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-exception-adapter-0.1.0 spec/exception_adapter_spec.rb