Sha256: 5fe2d3a3cb7bbd4e06bc7efb9d72b6c8cb5059eb1a7ea97d8bf5d8c8dcdd98ad
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true require "cases/helper" class PostgresqlTypeLookupTest < ActiveRecord::PostgreSQLTestCase setup do @connection = ActiveRecord::Base.connection end test "array delimiters are looked up correctly" do box_array = @connection.send(:type_map).lookup(1020) int_array = @connection.send(:type_map).lookup(1007) assert_equal ";", box_array.delimiter assert_equal ",", int_array.delimiter end test "array types correctly respect registration of subtypes" do int_array = @connection.send(:type_map).lookup(1007, -1, "integer[]") bigint_array = @connection.send(:type_map).lookup(1016, -1, "bigint[]") big_array = [123456789123456789] assert_raises(ActiveModel::RangeError) { int_array.serialize(big_array) } assert_equal "{123456789123456789}", @connection.type_cast(bigint_array.serialize(big_array)) end test "range types correctly respect registration of subtypes" do int_range = @connection.send(:type_map).lookup(3904, -1, "int4range") bigint_range = @connection.send(:type_map).lookup(3926, -1, "int8range") big_range = 0..123456789123456789 assert_raises(ActiveModel::RangeError) { int_range.serialize(big_range) } assert_equal "[0,123456789123456789]", @connection.type_cast(bigint_range.serialize(big_range)) end end
Version data entries
4 entries across 4 versions & 1 rubygems