diff options
author | Dan Seaver <git@danseaver.com> | 2012-05-05 13:51:01 -0400 |
---|---|---|
committer | Dan Seaver <git@danseaver.com> | 2012-05-05 13:54:00 -0400 |
commit | f7b8fbd4b12e07d94b2fbd23b07e8dd9c3f0e702 (patch) | |
tree | d965e63fec466463240d14b061cbacb4289dfafe /activerecord/test | |
parent | acb39848ae4cfe1d22cd8a83c5db636d80c22b47 (diff) | |
download | rails-f7b8fbd4b12e07d94b2fbd23b07e8dd9c3f0e702.tar.gz rails-f7b8fbd4b12e07d94b2fbd23b07e8dd9c3f0e702.tar.bz2 rails-f7b8fbd4b12e07d94b2fbd23b07e8dd9c3f0e702.zip |
Adds migration and schema dump support for INET, CIDR, and MACADDR
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/datatype_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 21 |
2 files changed, 24 insertions, 3 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb index ce08e4c6a7..d42f1ff5a1 100644 --- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb +++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb @@ -86,9 +86,9 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase end def test_data_type_of_network_address_types - assert_equal :string, @first_network_address.column_for_attribute(:cidr_address).type - assert_equal :string, @first_network_address.column_for_attribute(:inet_address).type - assert_equal :string, @first_network_address.column_for_attribute(:mac_address).type + assert_equal :cidr, @first_network_address.column_for_attribute(:cidr_address).type + assert_equal :inet, @first_network_address.column_for_attribute(:inet_address).type + assert_equal :macaddr, @first_network_address.column_for_attribute(:mac_address).type end def test_data_type_of_bit_string_types diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 15ceaa1fcc..ab80dd1d6d 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -236,6 +236,27 @@ class SchemaDumperTest < ActiveRecord::TestCase end end + def test_schema_dump_includes_inet_shorthand_definition + output = standard_dump + if %r{create_table "postgresql_network_address"} =~ output + assert_match %r{t.inet "inet_address"}, output + end + end + + def test_schema_dump_includes_cidr_shorthand_definition + output = standard_dump + if %r{create_table "postgresql_network_address"} =~ output + assert_match %r{t.cidr "cidr_address"}, output + end + end + + def test_schema_dump_includes_macaddr_shorthand_definition + output = standard_dump + if %r{create_table "postgresql_network_address"} =~ output + assert_match %r{t.macaddr "macaddr_address"}, output + end + end + def test_schema_dump_includes_hstores_shorthand_definition output = standard_dump if %r{create_table "postgresql_hstores"} =~ output |