aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/array_test.rb
diff options
context:
space:
mode:
authorKevin McPhillips <github@kevinmcphillips.ca>2016-06-28 14:54:17 -0400
committerKevin McPhillips <github@kevinmcphillips.ca>2016-06-29 10:31:09 -0400
commita023fd665701cd455d9458e1b1a0cd0e550202aa (patch)
treeb3d5ecd69d01c45351d6f6046e047c2484013256 /activerecord/test/cases/adapters/postgresql/array_test.rb
parent160cc331796ebfbcd6da83e96f391ab5732832b6 (diff)
downloadrails-a023fd665701cd455d9458e1b1a0cd0e550202aa.tar.gz
rails-a023fd665701cd455d9458e1b1a0cd0e550202aa.tar.bz2
rails-a023fd665701cd455d9458e1b1a0cd0e550202aa.zip
Do not specal case inspecting associated arrays of over 10 elements, preventing infinite looping in some cases.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/array_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/array_test.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb
index 380a90d765..70792e937c 100644
--- a/activerecord/test/cases/adapters/postgresql/array_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/array_test.rb
@@ -189,8 +189,13 @@ class PostgresqlArrayTest < ActiveRecord::PostgreSQLTestCase
end
def test_attribute_for_inspect_for_array_field
+ record = PgArray.new { |a| a.ratings = (1..10).to_a }
+ assert_equal("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", record.attribute_for_inspect(:ratings))
+ end
+
+ def test_attribute_for_inspect_for_array_field_for_large_array
record = PgArray.new { |a| a.ratings = (1..11).to_a }
- assert_equal("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]", record.attribute_for_inspect(:ratings))
+ assert_equal("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]", record.attribute_for_inspect(:ratings))
end
def test_escaping