diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-13 10:54:30 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-13 10:54:30 -0300 |
commit | 1c41d3b9827e839c0fc559b95cb07e45970b5ebb (patch) | |
tree | 69d206a7bba8e39e1510b91fe5e795fd12929c1e /activerecord/test | |
parent | 9a0c2e5c626cfbde527013bd0cfcec682baa48fa (diff) | |
parent | d569d0baad8b4c30b2144de2af1c98f2e91a2099 (diff) | |
download | rails-1c41d3b9827e839c0fc559b95cb07e45970b5ebb.tar.gz rails-1c41d3b9827e839c0fc559b95cb07e45970b5ebb.tar.bz2 rails-1c41d3b9827e839c0fc559b95cb07e45970b5ebb.zip |
Merge pull request #15686 from sgrif/sg-pg-int-arrays
PG arrays should type cast user input
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/array_test.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index 66750deb68..0b1e3295cc 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -97,8 +97,13 @@ class PostgresqlArrayTest < ActiveRecord::TestCase def test_type_cast_integers x = PgArray.new(ratings: ['1', '2']) - assert x.save! - assert_equal(['1', '2'], x.ratings) + + assert_equal([1, 2], x.ratings) + + x.save! + x.reload + + assert_equal([1, 2], x.ratings) end def test_select_with_strings |