1
0
Fork 0
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:
Yves Senn 2014-11-07 10:55:45 +01:00
parent 48e3edf9ad
commit 9253417909
3 changed files with 14 additions and 18 deletions

View file

@ -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

View file

@ -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

View file

@ -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