diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-07-16 09:49:55 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-07-16 10:56:22 +0200 |
commit | 754a373e301d2df0b12a11083405252722bc8366 (patch) | |
tree | 2101e7f8cf229e82007d19970538119599f2609c /activerecord/test/cases | |
parent | c612638a257be6cea631a1e5075f671ca328b8dc (diff) | |
download | rails-754a373e301d2df0b12a11083405252722bc8366.tar.gz rails-754a373e301d2df0b12a11083405252722bc8366.tar.bz2 rails-754a373e301d2df0b12a11083405252722bc8366.zip |
`change_column` for PG adapter respects `:array` option.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/array_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index 61a3a2ba0f..e5e877f0b0 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -27,6 +27,18 @@ class PostgresqlArrayTest < ActiveRecord::TestCase assert @column.array end + def test_change_column_with_array + @connection.add_column :pg_arrays, :snippets, :string, array: true, default: [] + @connection.change_column :pg_arrays, :snippets, :text, array: true, default: "{}" + + PgArray.reset_column_information + column = PgArray.columns.find { |c| c.name == 'snippets' } + + assert_equal :text, column.type + assert_equal [], column.default + assert column.array + end + def test_type_cast_array assert @column |