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