Sha256: a90e86ea02df855b47977ac32e5b43edaf94bcf9a5d34197ac57fd6b2566c91e

Contents?: true

Size: 730 Bytes

Versions: 8

Compression:

Stored size: 730 Bytes

Contents

require "cases/helper"

class TestRecord < ActiveRecord::Base
end

class TestDisconnectedAdapter < ActiveRecord::TestCase
  self.use_transactional_tests = false

  def setup
    @connection = ActiveRecord::Base.connection
  end

  teardown do
    return if in_memory_db?
    spec = ActiveRecord::Base.connection_config
    ActiveRecord::Base.establish_connection(spec)
  end

  unless in_memory_db?
    test "can't execute statements while disconnected" do
      @connection.execute "SELECT count(*) from products"
      @connection.disconnect!
      assert_raises(ActiveRecord::StatementInvalid) do
        silence_warnings do
          @connection.execute "SELECT count(*) from products"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ibm_db-5.2.0 test/cases/disconnected_test.rb
ibm_db-5.1.0 test/cases/disconnected_test.rb
ibm_db-5.0.5 test/cases/disconnected_test.rb
ibm_db-5.0.4 test/cases/disconnected_test.rb
ibm_db-5.0.3 test/cases/disconnected_test.rb
ibm_db-5.0.2 test/cases/disconnected_test.rb
ibm_db-4.0.0-x86-mingw32 test/cases/disconnected_test.rb
ibm_db-4.0.0 test/cases/disconnected_test.rb