Sha256: 199d0171acc86c3a1e12c4e4e9c00640f38c36e1011622ccf25d0e72f2201358

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "cases/helper_sqlserver"

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

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

  teardown do
    return if in_memory_db?
    db_config = ActiveRecord::Base.connection_db_config
    ActiveRecord::Base.establish_connection(db_config)
  end

  test "execute procedure after disconnect reconnects" do
    @connection.execute_procedure :sp_tables, "sst_datatypes"
    @connection.disconnect!
    @connection.execute_procedure :sp_tables, "sst_datatypes"
  end

  test "execute query after disconnect reconnects" do
    sql = "SELECT count(*) from products WHERE id IN(@0, @1)"
    binds = [
      ActiveRecord::Relation::QueryAttribute.new("id", 2, ActiveRecord::Type::BigInteger.new),
      ActiveRecord::Relation::QueryAttribute.new("id", 2, ActiveRecord::Type::BigInteger.new)
    ]

    @connection.exec_query sql, "TEST", binds
    @connection.disconnect!
    @connection.exec_query sql, "TEST", binds
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-7.1.11 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.10 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.9 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.8 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.7 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.6 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.5 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.4 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.3 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.2 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.1 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0.rc2 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0.rc1 test/cases/disconnected_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0.beta1 test/cases/disconnected_test_sqlserver.rb