Sha256: 8615c449925b0ee98aa2fe6fce07504563f4171d2d0ead1b2706ec5d6eb88df5

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

require File.join(File.dirname(File.expand_path(__FILE__)), 'spec_helper.rb')

describe Sequel::Database do
  specify "should provide disconnect functionality" do
    INTEGRATION_DB.test_connection
    INTEGRATION_DB.pool.size.should == 1
    INTEGRATION_DB.disconnect
    INTEGRATION_DB.pool.size.should == 0
  end

  specify "should provide disconnect functionality after preparing a statement" do
    INTEGRATION_DB.create_table!(:items){Integer :i}
    INTEGRATION_DB[:items].prepare(:first, :a).call
    INTEGRATION_DB.disconnect
    INTEGRATION_DB.pool.size.should == 0
    INTEGRATION_DB.drop_table(:items) rescue nil
  end

  specify "should raise Sequel::DatabaseError on invalid SQL" do
    proc{INTEGRATION_DB << "SELECT"}.should raise_error(Sequel::DatabaseError)
  end

  specify "should store underlying wrapped exception in Sequel::DatabaseError" do
    begin
      INTEGRATION_DB << "SELECT"
    rescue Sequel::DatabaseError=>e
      e.wrapped_exception.should be_a_kind_of(Exception)
    end
  end

  specify "should not have the connection pool swallow non-StandardError based exceptions" do
    proc{INTEGRATION_DB.pool.hold{raise Interrupt, "test"}}.should raise_error(Interrupt)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sequel-3.33.0 spec/integration/database_test.rb
sequel-3.32.0 spec/integration/database_test.rb
sequel-3.31.0 spec/integration/database_test.rb
sequel-3.30.0 spec/integration/database_test.rb
sequel-3.29.0 spec/integration/database_test.rb
sequel-3.28.0 spec/integration/database_test.rb