repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/set_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/set_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class SetTest < ActiveRecord::AbstractMysqlTestCase
include SchemaDumpingHelper
class SetTest < ActiveRecord::Base
end
def setup
SetTest.lease_connection.create_table :set_tests, id: false, force: true do |t|
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/mysql_explain_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/mysql_explain_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/author"
require "models/post"
class MySQLExplainTest < ActiveRecord::AbstractMysqlTestCase
fixtures :authors, :author_addresses
def test_explain_for_one_query
explain = Author.where(id: 1).explain.inspect
assert_match %(EXPLAIN SELECT `... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/count_deleted_rows_with_lock_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/count_deleted_rows_with_lock_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
require "models/author"
require "models/bulb"
require "models/car"
module ActiveRecord
class CountDeletedRowsWithLockTest < ActiveRecord::AbstractMysqlTestCase
test "delete and create in different threads synchronize correc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/connection_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/connection_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
class ConnectionTest < ActiveRecord::AbstractMysqlTestCase
include ConnectionHelper
def setup
super
@subscriber = SQLSubscriber.new
@subscription = ActiveSupport::Notifications.subscribe("sql.active_record", @sub... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/warnings_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/warnings_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_support/error_reporter/test_helper"
class WarningsTest < ActiveRecord::AbstractMysqlTestCase
def setup
@connection = ActiveRecord::Base.lease_connection
@original_db_warnings_action = :ignore
end
test "db_warnings_action :raise on war... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/adapter_prevent_writes_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/adapter_prevent_writes_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/ddl_helper"
class AdapterPreventWritesTest < ActiveRecord::AbstractMysqlTestCase
include DdlHelper
def setup
@conn = ActiveRecord::Base.lease_connection
end
def test_errors_when_an_insert_query_is_called_while_preventing_writes
Ac... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/mysql_enum_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/mysql_enum_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class MySQLEnumTest < ActiveRecord::AbstractMysqlTestCase
self.use_transactional_tests = false
include SchemaDumpingHelper
class EnumTest < ActiveRecord::Base
attribute :state, :integer
enum :state, {
s... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/nested_deadlock_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/nested_deadlock_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
module ActiveRecord
class NestedDeadlockTest < ActiveRecord::AbstractMysqlTestCase
self.use_transactional_tests = false
class Sample < ActiveRecord::Base
self.table_name = "samples"
end
setup do
@a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/active_schema_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/active_schema_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
class ActiveSchemaTest < ActiveRecord::AbstractMysqlTestCase
include ConnectionHelper
def setup
ActiveRecord::Base.lease_connection.send(:default_row_format)
ActiveRecord::Base.lease_connection.singleton_class.class_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/schema_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/schema_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/post"
require "models/comment"
module ActiveRecord
module ConnectionAdapters
class SchemaTest < ActiveRecord::AbstractMysqlTestCase
fixtures :posts
def setup
@connection = ActiveRecord::Base.lease_connection
db ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/abstract_mysql_adapter/schema_migrations_test.rb | activerecord/test/cases/adapters/abstract_mysql_adapter/schema_migrations_test.rb | # frozen_string_literal: true
require "cases/helper"
class SchemaMigrationsTest < ActiveRecord::AbstractMysqlTestCase
def setup
@pool = ActiveRecord::Base.connection_pool
@schema_migration = @pool.schema_migration
end
def test_renaming_index_on_foreign_key
connection.add_index "engines", "car_id"
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/create_unlogged_tables_test.rb | activerecord/test/cases/adapters/postgresql/create_unlogged_tables_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class UnloggedTablesTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
TABLE_NAME = "things"
LOGGED_FIELD = "relpersistence"
LOGGED_QUERY = "SELECT #{LOGGED_FIELD} FROM pg_class WHERE relname = '#{TA... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/transaction_nested_test.rb | activerecord/test/cases/adapters/postgresql/transaction_nested_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
require "concurrent/atomic/cyclic_barrier"
module ActiveRecord
class PostgresqlTransactionNestedTest < ActiveRecord::PostgreSQLTestCase
self.use_transactional_tests = false
class Sample < ActiveRecord::Base
self.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/infinity_test.rb | activerecord/test/cases/adapters/postgresql/infinity_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlInfinityTest < ActiveRecord::PostgreSQLTestCase
include InTimeZone
class PostgresqlInfinity < ActiveRecord::Base
end
setup do
@connection = ActiveRecord::Base.lease_connection
@connection.create_table(:postgresql_infinities) do |t|... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/network_test.rb | activerecord/test/cases/adapters/postgresql/network_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlNetworkTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class PostgresqlNetworkAddress < ActiveRecord::Base; end
setup do
@connection = ActiveRecord::Base.lease_connection
@co... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/collation_test.rb | activerecord/test/cases/adapters/postgresql/collation_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlCollationTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
def setup
@connection = ActiveRecord::Base.lease_connection
@connection.create_table :postgresql_collations, force: tru... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/money_with_decoder_test.rb | activerecord/test/cases/adapters/postgresql/money_with_decoder_test.rb | # frozen_string_literal: true
require "cases/adapters/postgresql/money_test"
class PostgresqlMoneyWithDecoderTest < PostgresqlMoneyTest
def setup
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.decode_money = true
ActiveRecord::Base.connection_pool.disconnect!
super
end
def teardown
super
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb | activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlCaseInsensitiveTest < ActiveRecord::PostgreSQLTestCase
class Default < ActiveRecord::Base; end
def test_case_insensitiveness
connection = ActiveRecord::Base.lease_connection
attr = Default.arel_table[:char1]
comparison = connection... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/serial_test.rb | activerecord/test/cases/adapters/postgresql/serial_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlSerialTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class PostgresqlSerial < ActiveRecord::Base; end
setup do
@connection = ActiveRecord::Base.lease_connection
@connection... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/composite_test.rb | activerecord/test/cases/adapters/postgresql/composite_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
module PostgresqlCompositeBehavior
include ConnectionHelper
class PostgresqlComposite < ActiveRecord::Base
self.table_name = "postgresql_composites"
end
def setup
super
@connection = ActiveRecord::Base.leas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/bytea_test.rb | activerecord/test/cases/adapters/postgresql/bytea_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlByteaTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class ByteaDataType < ActiveRecord::Base
self.table_name = "bytea_data_type"
end
def setup
@connection = ActiveRecord:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/foreign_table_test.rb | activerecord/test/cases/adapters/postgresql/foreign_table_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/professor"
if ActiveRecord::Base.lease_connection.supports_foreign_tables?
class ForeignTableTest < ActiveRecord::TestCase
self.use_transactional_tests = false
class ForeignProfessor < ActiveRecord::Base
self.table_name = "foreign_p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/geometric_test.rb | activerecord/test/cases/adapters/postgresql/geometric_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
require "support/schema_dumping_helper"
class PostgresqlPointTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelper
include SchemaDumpingHelper
class PostgresqlPoint < ActiveRecord::Base
attribute :x, :point
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb | activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/computer"
require "models/developer"
class PreparedStatementsDisabledTest < ActiveRecord::PostgreSQLTestCase
fixtures :developers
def setup
@conn = ActiveRecord::Base.establish_connection :arunit_without_prepared_statements
end
def tea... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb | activerecord/test/cases/adapters/postgresql/extension_migration_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlExtensionMigrationTest < ActiveRecord::PostgreSQLTestCase
self.use_transactional_tests = false
class EnableHstore < ActiveRecord::Migration::Current
def change
enable_extension "hstore"
end
end
class DisableHstore < ActiveRec... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/binary_with_decoder_test.rb | activerecord/test/cases/adapters/postgresql/binary_with_decoder_test.rb | # frozen_string_literal: true
require "cases/binary_test"
# Run the binary tests with PostgreSQL bytea decoder enabled
class BinaryWithDecoderTest < BinaryTest
def setup
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.decode_bytea = true
ActiveRecord::Base.connection_pool.disconnect!
super
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/ltree_test.rb | activerecord/test/cases/adapters/postgresql/ltree_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlLtreeTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class Ltree < ActiveRecord::Base
self.table_name = "ltrees"
end
def setup
@connection = ActiveRecord::Base.lease_connec... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/bind_parameter_test.rb | activerecord/test/cases/adapters/postgresql/bind_parameter_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/post"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter
class BindParameterTest < ActiveRecord::PostgreSQLTestCase
fixtures :posts
def test_where_with_string_for_string_column_using_bind_parameters
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/rename_table_test.rb | activerecord/test/cases/adapters/postgresql/rename_table_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlRenameTableTest < ActiveRecord::PostgreSQLTestCase
def setup
@connection = ActiveRecord::Base.lease_connection
end
def teardown
@connection.drop_table "before_rename", if_exists: true
@connection.drop_table "after_rename", if_exis... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/enum_test.rb | activerecord/test/cases/adapters/postgresql/enum_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
require "support/schema_dumping_helper"
class PostgresqlEnumTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelper
include SchemaDumpingHelper
class PostgresqlEnum < ActiveRecord::Base
self.table_name = "post... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/dbconsole_test.rb | activerecord/test/cases/adapters/postgresql/dbconsole_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_support/testing/method_call_assertions"
module ActiveRecord
module ConnectionAdapters
class PostgresqlDbConsoleTest < ActiveRecord::PostgreSQLTestCase
include ActiveSupport::Testing::MethodCallAssertions
ENV_VARS = %w(PGUSER PGHOS... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/money_test.rb | activerecord/test/cases/adapters/postgresql/money_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlMoneyTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class PostgresqlMoney < ActiveRecord::Base
validates :depth, numericality: true
end
def setup
super
@connection = ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/postgresql_rake_test.rb | activerecord/test/cases/adapters/postgresql/postgresql_rake_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_record/tasks/database_tasks"
module ActiveRecord
class PostgreSQLDBCreateTest < ActiveRecord::TestCase
def setup
@connection = Class.new { def create_database(*); end }.new
@configuration = {
"adapter" => "postgresql",
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/partitions_test.rb | activerecord/test/cases/adapters/postgresql/partitions_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgreSQLPartitionsTest < ActiveRecord::PostgreSQLTestCase
def setup
@previous_unlogged_tables = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables
@connection = ActiveRecord::Base.lease_connection
ActiveRecord::Connecti... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/change_schema_test.rb | activerecord/test/cases/adapters/postgresql/change_schema_test.rb | # frozen_string_literal: true
require "cases/helper"
module ActiveRecord
class Migration
class PGChangeSchemaTest < ActiveRecord::PostgreSQLTestCase
attr_reader :connection
def setup
super
@connection = ActiveRecord::Base.lease_connection
connection.create_table(:strings) do... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/numbers_test.rb | activerecord/test/cases/adapters/postgresql/numbers_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlNumberTest < ActiveRecord::PostgreSQLTestCase
class PostgresqlNumber < ActiveRecord::Base; end
setup do
@connection = ActiveRecord::Base.lease_connection
@connection.create_table("postgresql_numbers", force: true) do |t|
t.column ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/domain_test.rb | activerecord/test/cases/adapters/postgresql/domain_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
class PostgresqlDomainTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelper
class PostgresqlDomain < ActiveRecord::Base
self.table_name = "postgresql_domains"
end
def setup
@connection = ActiveRecord:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/hstore_test.rb | activerecord/test/cases/adapters/postgresql/hstore_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
require "support/stubs/strong_parameters"
class PostgresqlHstoreTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class Hstore < ActiveRecord::Base
self.table_name = "hstores"
store_accessor :se... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/uuid_test.rb | activerecord/test/cases/adapters/postgresql/uuid_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
module PostgresqlUUIDHelper
def connection
@connection ||= ActiveRecord::Base.lease_connection
end
def drop_table(name)
connection.drop_table name, if_exists: true
end
def uuid_function
connection.supp... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/cidr_test.rb | activerecord/test/cases/adapters/postgresql/cidr_test.rb | # frozen_string_literal: true
require "cases/helper"
require "ipaddr"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter < AbstractAdapter
class CidrTest < ActiveRecord::PostgreSQLTestCase
test "type casting IPAddr for database" do
type = OID::Cidr.new
ip = I... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/interval_test.rb | activerecord/test/cases/adapters/postgresql/interval_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlIntervalTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class IntervalDataType < ActiveRecord::Base
attribute :legacy_term, :string
end
def setup
@connection = ActiveRecor... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/optimizer_hints_test.rb | activerecord/test/cases/adapters/postgresql/optimizer_hints_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/post"
class PostgresqlOptimizerHintsTest < ActiveRecord::PostgreSQLTestCase
if supports_optimizer_hints?
fixtures :posts
def setup
enable_extension!("pg_hint_plan", ActiveRecord::Base.lease_connection)
end
def test_optimize... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/virtual_column_test.rb | activerecord/test/cases/adapters/postgresql/virtual_column_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
if ActiveRecord::Base.lease_connection.supports_virtual_columns?
class PostgresqlVirtualColumnTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class VirtualColumn < ActiveRecord::Base
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/utils_test.rb | activerecord/test/cases/adapters/postgresql/utils_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_record/connection_adapters/postgresql/utils"
class PostgreSQLUtilsTest < ActiveRecord::PostgreSQLTestCase
Name = ActiveRecord::ConnectionAdapters::PostgreSQL::Name
include ActiveRecord::ConnectionAdapters::PostgreSQL::Utils
def test_extract_s... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb | activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/ddl_helper"
require "support/connection_helper"
require "active_support/core_ext/object/with"
require "active_support/error_reporter/test_helper"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapterTest < ActiveRecord::Postg... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/explain_test.rb | activerecord/test/cases/adapters/postgresql/explain_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/author"
require "models/post"
class PostgreSQLExplainTest < ActiveRecord::PostgreSQLTestCase
fixtures :authors, :author_addresses
def test_explain_for_one_query
explain = Author.where(id: 1).explain.inspect
assert_match %r(EXPLAIN SELEC... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/array_test.rb | activerecord/test/cases/adapters/postgresql/array_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlArrayTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
include InTimeZone
class PgArray < ActiveRecord::Base
self.table_name = "pg_arrays"
end
def setup
@connection = Acti... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/json_test.rb | activerecord/test/cases/adapters/postgresql/json_test.rb | # frozen_string_literal: true
require "cases/helper"
require "cases/json_shared_test_cases"
module PostgresqlJSONSharedTestCases
include JSONSharedTestCases
def setup
super
@connection.create_table("json_data_type") do |t|
t.public_send column_type, "payload", default: {} # t.json 'payload', defaul... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/postgresql_adapter_prevent_writes_test.rb | activerecord/test/cases/adapters/postgresql/postgresql_adapter_prevent_writes_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/ddl_helper"
require "support/connection_helper"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapterPreventWritesTest < ActiveRecord::PostgreSQLTestCase
include DdlHelper
include ConnectionHelper
def setup
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/transaction_test.rb | activerecord/test/cases/adapters/postgresql/transaction_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
require "concurrent/atomic/cyclic_barrier"
module ActiveRecord
class PostgresqlTransactionTest < ActiveRecord::PostgreSQLTestCase
self.use_transactional_tests = false
class Sample < ActiveRecord::Base
self.table_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/xml_test.rb | activerecord/test/cases/adapters/postgresql/xml_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlXMLTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class XmlDataType < ActiveRecord::Base
self.table_name = "xml_data_type"
end
def setup
@connection = ActiveRecord::Base.l... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/quoting_test.rb | activerecord/test/cases/adapters/postgresql/quoting_test.rb | # frozen_string_literal: true
require "cases/helper"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter
class QuotingTest < ActiveRecord::PostgreSQLTestCase
def setup
@conn = ActiveRecord::Base.lease_connection
@raise_int_wider_than_64bit = ActiveRecord.raise... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb | activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb | # frozen_string_literal: true
require "cases/helper"
class SchemaThing < ActiveRecord::Base
end
class SchemaAuthorizationTest < ActiveRecord::PostgreSQLTestCase
self.use_transactional_tests = false
TABLE_NAME = "schema_things"
COLUMNS = [
"id serial primary key",
"name character varying(50)"
]
USE... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/range_test.rb | activerecord/test/cases/adapters/postgresql/range_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
class PostgresqlRange < ActiveRecord::Base
self.table_name = "postgresql_ranges"
self.time_zone_aware_types += [:tsrange, :tstzrange]
end
class PostgresqlRangeTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelpe... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/full_text_test.rb | activerecord/test/cases/adapters/postgresql/full_text_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlFullTextTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class Tsvector < ActiveRecord::Base; end
setup do
@connection = ActiveRecord::Base.lease_connection
@connection.create... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb | activerecord/test/cases/adapters/postgresql/type_lookup_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlTypeLookupTest < ActiveRecord::PostgreSQLTestCase
setup do
@connection = ActiveRecord::Base.lease_connection
end
test "array delimiters are looked up correctly" do
box_array = @connection.send(:type_map).lookup(1020)
int_array = @... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/datatype_test.rb | activerecord/test/cases/adapters/postgresql/datatype_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/ddl_helper"
class PostgresqlTime < ActiveRecord::Base
# Declare attributes to get rid from deprecation warnings on ActiveRecord 6.1
attribute :time_interval, :string
attribute :scaled_time_interval, :interval
end
class PostgresqlOid <... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/connection_test.rb | activerecord/test/cases/adapters/postgresql/connection_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
module ActiveRecord
class PostgresqlConnectionTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelper
class NonExistentTable < ActiveRecord::Base
end
def setup
super
@subscriber = SQLSubsc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb | activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
class PostgreSQLReferentialIntegrityTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelper
IS_REFERENTIAL_INTEGRITY_SQL = lambda do |sql|
sql.match(/DISABLE TRIGGER ALL/) || sql.match(/ENABLE TRIGGER ALL/)
en... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/integer_test.rb | activerecord/test/cases/adapters/postgresql/integer_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_support/core_ext/numeric/bytes"
class PostgresqlIntegerTest < ActiveRecord::PostgreSQLTestCase
class PgInteger < ActiveRecord::Base
end
def setup
@connection = ActiveRecord::Base.lease_connection
@connection.transaction do
@con... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/bytea_with_decoder_test.rb | activerecord/test/cases/adapters/postgresql/bytea_with_decoder_test.rb | # frozen_string_literal: true
require "cases/adapters/postgresql/bytea_test"
class PostgresqlByteaWithDecoderTest < PostgresqlByteaTest
def setup
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.decode_bytea = true
ActiveRecord::Base.connection_pool.disconnect!
super
end
def teardown
super
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/citext_test.rb | activerecord/test/cases/adapters/postgresql/citext_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class PostgresqlCitextTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class Citext < ActiveRecord::Base
self.table_name = "citexts"
end
def setup
@connection = ActiveRecord::Base.lease_con... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb | activerecord/test/cases/adapters/postgresql/statement_pool_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/computer"
require "models/developer"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter < AbstractAdapter
class InactivePgConnection
def initialize
@raw_connection = nil
end
def query... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/date_test.rb | activerecord/test/cases/adapters/postgresql/date_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/topic"
class PostgresqlDateTest < ActiveRecord::PostgreSQLTestCase
def test_load_infinity_and_beyond
topic = Topic.find_by_sql("SELECT 'infinity'::date AS last_read").first
assert_predicate topic.last_read, :infinite?, "timestamp should be... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/invertible_migration_test.rb | activerecord/test/cases/adapters/postgresql/invertible_migration_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlInvertibleMigrationTest < ActiveRecord::PostgreSQLTestCase
class SilentMigration < ActiveRecord::Migration::Current
def write(*); end
end
class ExpressionIndexMigration < SilentMigration
def change
create_table("settings") do |t... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/bit_string_test.rb | activerecord/test/cases/adapters/postgresql/bit_string_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
require "support/schema_dumping_helper"
class PostgresqlBitStringTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelper
include SchemaDumpingHelper
class PostgresqlBitString < ActiveRecord::Base; end
def setup... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/active_schema_test.rb | activerecord/test/cases/adapters/postgresql/active_schema_test.rb | # frozen_string_literal: true
require "cases/helper"
class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase
def setup
ActiveRecord::Base.lease_connection.materialize_transactions
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
def execute(sql, name = nil) sql end
en... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/schema_test.rb | activerecord/test/cases/adapters/postgresql/schema_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/default"
require "support/schema_dumping_helper"
require "active_support/core_ext/object/with"
module PGSchemaHelper
def with_schema_search_path(schema_search_path)
@connection.schema_search_path = schema_search_path
@connection.schema_cac... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/deferred_constraints_test.rb | activerecord/test/cases/adapters/postgresql/deferred_constraints_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/author"
class PostgresqlDeferredConstraintsTest < ActiveRecord::PostgreSQLTestCase
def setup
@connection = ActiveRecord::Base.lease_connection
@fk = @connection.foreign_keys("authors").first.name
@other_fk = @connection.foreign_keys("l... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/postgresql/timestamp_test.rb | activerecord/test/cases/adapters/postgresql/timestamp_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/developer"
require "models/topic"
class PostgresqlTimestampTest < ActiveRecord::PostgreSQLTestCase
class PostgresqlTimestampWithZone < ActiveRecord::Base; end
self.use_transactional_tests = false
setup do
@connection = ActiveRecord::Base... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_prevent_writes_test.rb | activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_prevent_writes_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/ddl_helper"
module ActiveRecord
module ConnectionAdapters
class SQLite3AdapterPreventWritesTest < ActiveRecord::SQLite3TestCase
include DdlHelper
self.use_transactional_tests = false
def setup
@conn = ActiveRecord:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/collation_test.rb | activerecord/test/cases/adapters/sqlite3/collation_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class SQLite3CollationTest < ActiveRecord::SQLite3TestCase
include SchemaDumpingHelper
def setup
@connection = ActiveRecord::Base.lease_connection
@connection.create_table :collation_table_sqlite3, force: true do... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/virtual_table_test.rb | activerecord/test/cases/adapters/sqlite3/virtual_table_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
class SQLite3VirtualTableTest < ActiveRecord::SQLite3TestCase
include SchemaDumpingHelper
def setup
@connection = ActiveRecord::Base.lease_connection
@connection.create_virtual_table :searchables, :fts5, ["conten... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/bind_parameter_test.rb | activerecord/test/cases/adapters/sqlite3/bind_parameter_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/post"
module ActiveRecord
module ConnectionAdapters
class SQLite3Adapter
class BindParameterTest < ActiveRecord::SQLite3TestCase
fixtures :posts
def test_where_with_string_for_string_column_using_bind_parameters
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/dbconsole_test.rb | activerecord/test/cases/adapters/sqlite3/dbconsole_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_support/testing/method_call_assertions"
module ActiveRecord
module ConnectionAdapters
class SQLite3DbConsoleTest < ActiveRecord::SQLite3TestCase
include ActiveSupport::Testing::MethodCallAssertions
def test_sqlite3
config ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/owner"
require "tempfile"
require "support/ddl_helper"
module ActiveRecord
module ConnectionAdapters
class SQLite3AdapterTest < ActiveRecord::SQLite3TestCase
include DdlHelper
self.use_transactional_tests = false
class Dual... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/virtual_column_test.rb | activerecord/test/cases/adapters/sqlite3/virtual_column_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
if ActiveRecord::Base.lease_connection.supports_virtual_columns?
class SQLite3VirtualColumnTest < ActiveRecord::SQLite3TestCase
include SchemaDumpingHelper
class VirtualColumn < ActiveRecord::Base
end
def ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/explain_test.rb | activerecord/test/cases/adapters/sqlite3/explain_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/author"
require "models/post"
class SQLite3ExplainTest < ActiveRecord::SQLite3TestCase
fixtures :authors, :author_addresses
def test_explain_for_one_query
explain = Author.where(id: 1).explain.inspect
assert_match %r(EXPLAIN for: SELECT... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/json_test.rb | activerecord/test/cases/adapters/sqlite3/json_test.rb | # frozen_string_literal: true
require "cases/helper"
require "cases/json_shared_test_cases"
class SQLite3JSONTest < ActiveRecord::SQLite3TestCase
include JSONSharedTestCases
def setup
super
@connection.create_table("json_data_type") do |t|
t.json "payload", default: {}
t.json "with_defaults",... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/transaction_test.rb | activerecord/test/cases/adapters/sqlite3/transaction_test.rb | # frozen_string_literal: true
require "cases/helper"
class SQLite3TransactionTest < ActiveRecord::SQLite3TestCase
test "shared_cached? is true when cache-mode is enabled" do
with_connection(flags: shared_cache_flags) do |conn|
assert_predicate(conn, :shared_cache?)
end
end
test "shared_cached? is... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/quoting_test.rb | activerecord/test/cases/adapters/sqlite3/quoting_test.rb | # frozen_string_literal: true
require "cases/helper"
require "bigdecimal"
require "securerandom"
class SQLite3QuotingTest < ActiveRecord::SQLite3TestCase
def setup
super
@conn = ActiveRecord::Base.lease_connection
end
def test_quote_string
assert_equal "''", @conn.quote_string("'")
end
def tes... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb | activerecord/test/cases/adapters/sqlite3/copy_table_test.rb | # frozen_string_literal: true
require "cases/helper"
class CopyTableTest < ActiveRecord::SQLite3TestCase
fixtures :customers
def setup
@connection = ActiveRecord::Base.lease_connection
end
def test_copy_table(from = "customers", to = "customers2", options = {})
assert_nothing_raised { copy_table(fro... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb | activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb | # frozen_string_literal: true
require "cases/helper"
class SQLite3StatementPoolTest < ActiveRecord::SQLite3TestCase
if Process.respond_to?(:fork)
def test_cache_is_per_pid
cache = ActiveRecord::ConnectionAdapters::SQLite3Adapter::StatementPool.new(10)
cache["foo"] = "bar"
assert_equal "bar", c... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/sqlite_rake_test.rb | activerecord/test/cases/adapters/sqlite3/sqlite_rake_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_record/tasks/database_tasks"
require "pathname"
module ActiveRecord
class SqliteDBCreateTest < ActiveRecord::TestCase
def setup
@database = "db_create.sqlite3"
@configuration = {
"adapter" => "sqlite3",
"datab... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb | activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/owner"
module ActiveRecord
module ConnectionAdapters
class SQLite3CreateFolder < ActiveRecord::SQLite3TestCase
def test_sqlite_creates_directory
Dir.mktmpdir do |dir|
dir = Pathname.new(dir)
@conn = SQLite3Ada... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/mysql2/check_constraint_quoting_test.rb | activerecord/test/cases/adapters/mysql2/check_constraint_quoting_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/schema_dumping_helper"
if ActiveRecord::Base.lease_connection.supports_check_constraints?
class Mysql2CheckConstraintQuotingTest < ActiveRecord::Mysql2TestCase
include SchemaDumpingHelper
setup do
@connection = ActiveRecord::Base.l... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/mysql2/dbconsole_test.rb | activerecord/test/cases/adapters/mysql2/dbconsole_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_support/testing/method_call_assertions"
module ActiveRecord
module ConnectionAdapters
class Mysql2DbConsoleTest < ActiveRecord::Mysql2TestCase
include ActiveSupport::Testing::MethodCallAssertions
def test_mysql
config = ma... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb | activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/ddl_helper"
class Mysql2AdapterTest < ActiveRecord::Mysql2TestCase
include DdlHelper
def setup
@conn = ActiveRecord::Base.lease_connection
@original_db_warnings_action = :ignore
end
def test_connection_error
error = assert_rai... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/mysql2/mysql2_rake_test.rb | activerecord/test/cases/adapters/mysql2/mysql2_rake_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_record/tasks/database_tasks"
module ActiveRecord
class MysqlDBCreateTest < ActiveRecord::TestCase
def setup
@connection = Class.new do
def create_database(*); end
def error_number(_); end
end.new
@configuratio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/trilogy/dbconsole_test.rb | activerecord/test/cases/adapters/trilogy/dbconsole_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_support/testing/method_call_assertions"
module ActiveRecord
module ConnectionAdapters
class TrilogyDbConsoleTest < ActiveRecord::TrilogyTestCase
include ActiveSupport::Testing::MethodCallAssertions
def test_trilogy
config ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/trilogy/trilogy_adapter_test.rb | activerecord/test/cases/adapters/trilogy/trilogy_adapter_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/ddl_helper"
require "models/book"
require "models/post"
require "timeout"
class TrilogyAdapterTest < ActiveRecord::TrilogyTestCase
setup do
@conn = ActiveRecord::Base.lease_connection
end
test "connection_error" do
error = assert_rai... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/adapters/trilogy/trilogy_rake_test.rb | activerecord/test/cases/adapters/trilogy/trilogy_rake_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_record/tasks/database_tasks"
module ActiveRecord
class TrilogyDBCreateTest < ActiveRecord::TestCase
def setup
@connection = Class.new do
def create_database(*); end
def error_number(_); end
end.new
@configurat... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb | activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
module ActiveRecord
module ConnectionAdapters
class MysqlTypeLookupTest < ActiveRecord::TestCase
if current_adapter?(:Mysql2Adapter, :TrilogyAdapter)
include ConnectionHelper
setup do
@conne... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb | activerecord/test/cases/connection_adapters/adapter_leasing_test.rb | # frozen_string_literal: true
require "cases/helper"
module ActiveRecord
module ConnectionAdapters
class AdapterLeasingTest < ActiveRecord::TestCase
class Pool < ConnectionPool
def insert_connection_for_test!(c)
synchronize do
adopt_connection(c)
@available.add c
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/connection_handler_test.rb | activerecord/test/cases/connection_adapters/connection_handler_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/person"
module ActiveRecord
module ConnectionAdapters
class ConnectionHandlerTest < ActiveRecord::TestCase
fixtures :people
def setup
@handler = ConnectionHandler.new
@connection_name = "ActiveRecord::Base"
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/schema_cache_test.rb | activerecord/test/cases/connection_adapters/schema_cache_test.rb | # frozen_string_literal: true
require "cases/helper"
require "active_support/core_ext/object/with"
module ActiveRecord
module ConnectionAdapters
class SchemaCacheTest < ActiveRecord::TestCase
self.use_transactional_tests = false
def setup
@deduplicable_registries_were = deduplicable_classes... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/standalone_connection_test.rb | activerecord/test/cases/connection_adapters/standalone_connection_test.rb | # frozen_string_literal: true
require "cases/helper"
require "support/connection_helper"
module ActiveRecord
module ConnectionAdapters
class StandaloneConnectionTest < ActiveRecord::TestCase
def setup
super
db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/connection_handlers_sharding_db_test.rb | activerecord/test/cases/connection_adapters/connection_handlers_sharding_db_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/person"
module ActiveRecord
module ConnectionAdapters
class ConnectionHandlersShardingDbTest < ActiveRecord::TestCase
self.use_transactional_tests = false
fixtures :people
def teardown
clean_up_connection_handler
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rb | activerecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/person"
module ActiveRecord
module ConnectionAdapters
class ConnectionHandlersMultiDbTest < ActiveRecord::TestCase
self.use_transactional_tests = false
fixtures :people
def setup
@handler = ConnectionHandler.new
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/cases/connection_adapters/connection_swapping_nested_test.rb | activerecord/test/cases/connection_adapters/connection_swapping_nested_test.rb | # frozen_string_literal: true
require "cases/helper"
require "models/person"
module ActiveRecord
module ConnectionAdapters
class ConnectionSwappingNestedTest < ActiveRecord::TestCase
self.use_transactional_tests = false
fixtures :people
def teardown
clean_up_connection_handler
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.