diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-03-26 17:14:05 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-04-01 09:54:32 +0200 |
commit | 4d344bb4fdc0a57aff60c755dda0c5e3c6e08cdb (patch) | |
tree | 81d596d44dc7dabe25c8cd20ee7f9d72c347bb35 /activerecord/test/cases | |
parent | 5eb13fcaac5c7328e048bf4e5d2d8418fefc5ac1 (diff) | |
download | rails-4d344bb4fdc0a57aff60c755dda0c5e3c6e08cdb.tar.gz rails-4d344bb4fdc0a57aff60c755dda0c5e3c6e08cdb.tar.bz2 rails-4d344bb4fdc0a57aff60c755dda0c5e3c6e08cdb.zip |
PostgreSQL determine `Column#type` through corresponding OID. #7814
I ran the whole test suite and compared the old to the new types.
Following is the list of types that did change with this patch:
```
DIFFERENT TYPE FOR mood: NEW: enum, BEFORE:
DIFFERENT TYPE FOR floatrange: NEW: floatrange, BEFORE: float
```
The `floatrange` is a custom type. The old type `float` was simply a coincidence
form the name `floatrange` and our type-guessing.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/enum_test.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/quoting_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/column_definition_test.rb | 4 |
3 files changed, 5 insertions, 6 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/enum_test.rb b/activerecord/test/cases/adapters/postgresql/enum_test.rb index 381c397922..ac78c2426e 100644 --- a/activerecord/test/cases/adapters/postgresql/enum_test.rb +++ b/activerecord/test/cases/adapters/postgresql/enum_test.rb @@ -29,8 +29,7 @@ class PostgresqlEnumTest < ActiveRecord::TestCase def test_column column = PostgresqlEnum.columns_hash["current_mood"] - # TODO: enum columns should be of type enum or string, not nil. - assert_nil column.type + assert_equal :enum, column.type assert_equal "mood", column.sql_type assert_not column.number? assert_not column.text? diff --git a/activerecord/test/cases/adapters/postgresql/quoting_test.rb b/activerecord/test/cases/adapters/postgresql/quoting_test.rb index 39f5b9b18a..51846e22d9 100644 --- a/activerecord/test/cases/adapters/postgresql/quoting_test.rb +++ b/activerecord/test/cases/adapters/postgresql/quoting_test.rb @@ -47,9 +47,9 @@ module ActiveRecord def test_quote_cast_numeric fixnum = 666 - c = PostgreSQLColumn.new(nil, nil, OID::Decimal.new, 'varchar') + c = PostgreSQLColumn.new(nil, nil, OID::String.new, 'varchar') assert_equal "'666'", @conn.quote(fixnum, c) - c = PostgreSQLColumn.new(nil, nil, OID::Decimal.new, 'text') + c = PostgreSQLColumn.new(nil, nil, OID::Text.new, 'text') assert_equal "'666'", @conn.quote(fixnum, c) end diff --git a/activerecord/test/cases/column_definition_test.rb b/activerecord/test/cases/column_definition_test.rb index c7b64f29c3..c1dd1f1c69 100644 --- a/activerecord/test/cases/column_definition_test.rb +++ b/activerecord/test/cases/column_definition_test.rb @@ -127,13 +127,13 @@ module ActiveRecord if current_adapter?(:PostgreSQLAdapter) def test_bigint_column_should_map_to_integer - oid = PostgreSQLAdapter::OID::Identity.new + oid = PostgreSQLAdapter::OID::Integer.new bigint_column = PostgreSQLColumn.new('number', nil, oid, "bigint") assert_equal :integer, bigint_column.type end def test_smallint_column_should_map_to_integer - oid = PostgreSQLAdapter::OID::Identity.new + oid = PostgreSQLAdapter::OID::Integer.new smallint_column = PostgreSQLColumn.new('number', nil, oid, "smallint") assert_equal :integer, smallint_column.type end |