aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorLuke Steensen <luke.steensen@gmail.com>2014-03-30 11:10:41 -0500
committerLuke Steensen <luke.steensen@gmail.com>2014-03-30 11:10:41 -0500
commit78e4862f6f7079c10af44c269bf98046a41bc8cf (patch)
tree04b06dc665f52656b8f77252777d582af3ed33f5 /activerecord/test/cases
parent74a821760cc5c78d9932bbb1f15ba9cfba89b28d (diff)
downloadrails-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/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/array_test.rb11
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: "{}"