aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-07-16 09:49:55 +0200
committerYves Senn <yves.senn@gmail.com>2013-07-16 10:56:22 +0200
commit754a373e301d2df0b12a11083405252722bc8366 (patch)
tree2101e7f8cf229e82007d19970538119599f2609c /activerecord/test
parentc612638a257be6cea631a1e5075f671ca328b8dc (diff)
downloadrails-754a373e301d2df0b12a11083405252722bc8366.tar.gz
rails-754a373e301d2df0b12a11083405252722bc8366.tar.bz2
rails-754a373e301d2df0b12a11083405252722bc8366.zip
`change_column` for PG adapter respects `:array` option.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/array_test.rb12
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