mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
pg tests, get rid of sql_types_test.rb
.
This commit is contained in:
parent
48e3edf9ad
commit
9253417909
3 changed files with 14 additions and 18 deletions
|
@ -28,6 +28,13 @@ class PostgresqlByteaTest < ActiveRecord::TestCase
|
|||
assert_equal :binary, @column.type
|
||||
end
|
||||
|
||||
def test_binary_columns_are_limitless_the_upper_limit_is_one_GB
|
||||
assert_equal 'bytea', @connection.type_to_sql(:binary, 100_000)
|
||||
assert_raise ActiveRecord::ActiveRecordError do
|
||||
@connection.type_to_sql :binary, 4294967295
|
||||
end
|
||||
end
|
||||
|
||||
def test_type_cast_binary_converts_the_encoding
|
||||
assert @column
|
||||
|
||||
|
|
|
@ -94,6 +94,13 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase
|
|||
assert @first_oid.reload
|
||||
assert_equal new_value, @first_oid.obj_id
|
||||
end
|
||||
|
||||
def test_text_columns_are_limitless_the_upper_limit_is_one_GB
|
||||
assert_equal 'text', @connection.type_to_sql(:text, 100_000)
|
||||
assert_raise ActiveRecord::ActiveRecordError do
|
||||
@connection.type_to_sql :text, 4294967295
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class PostgresqlInternalDataTypeTest < ActiveRecord::TestCase
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
require "cases/helper"
|
||||
|
||||
class SqlTypesTest < ActiveRecord::TestCase
|
||||
def test_binary_types
|
||||
assert_equal 'bytea', type_to_sql(:binary, 100_000)
|
||||
assert_raise ActiveRecord::ActiveRecordError do
|
||||
type_to_sql :binary, 4294967295
|
||||
end
|
||||
assert_equal 'text', type_to_sql(:text, 100_000)
|
||||
assert_raise ActiveRecord::ActiveRecordError do
|
||||
type_to_sql :text, 4294967295
|
||||
end
|
||||
end
|
||||
|
||||
def type_to_sql(*args)
|
||||
ActiveRecord::Base.connection.type_to_sql(*args)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue