diff options
author | Luke Steensen <luke.steensen@gmail.com> | 2014-03-30 11:10:41 -0500 |
---|---|---|
committer | Luke Steensen <luke.steensen@gmail.com> | 2014-03-30 11:10:41 -0500 |
commit | 78e4862f6f7079c10af44c269bf98046a41bc8cf (patch) | |
tree | 04b06dc665f52656b8f77252777d582af3ed33f5 /activerecord/test | |
parent | 74a821760cc5c78d9932bbb1f15ba9cfba89b28d (diff) | |
download | rails-78e4862f6f7079c10af44c269bf98046a41bc8cf.tar.gz rails-78e4862f6f7079c10af44c269bf98046a41bc8cf.tar.bz2 rails-78e4862f6f7079c10af44c269bf98046a41bc8cf.zip |
fix bug on non empty defaults for pg array columns
fixes #10613
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/array_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index 714da83a54..36ded66998 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -48,6 +48,17 @@ class PostgresqlArrayTest < ActiveRecord::TestCase PgArray.reset_column_information end + def test_default_strings + @connection.add_column 'pg_arrays', 'names', :string, array: true, default: ["foo", "bar"] + PgArray.reset_column_information + column = PgArray.columns_hash["names"] + + assert_equal(["foo", "bar"], column.default) + assert_equal(["foo", "bar"], PgArray.new.names) + ensure + PgArray.reset_column_information + 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: "{}" |