Sha256: a996670e578337c2920fb65a28cf4f217750f2137105f5c2148ff4680ee388fc
Contents?: true
Size: 1.14 KB
Versions: 12
Compression:
Stored size: 1.14 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.lease_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! assert_nothing_raised do @connection.execute_procedure :sp_tables, "sst_datatypes" end 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! assert_nothing_raised do @connection.exec_query sql, "TEST", binds end end end
Version data entries
12 entries across 12 versions & 1 rubygems