aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/array_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb
index ff553c3f1a..fa7bebf08b 100644
--- a/activerecord/test/cases/adapters/postgresql/array_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/array_test.rb
@@ -254,6 +254,15 @@ class PostgresqlArrayTest < ActiveRecord::TestCase
end
end
+ def test_assigning_non_array_value
+ record = PgArray.new(tags: "not-an-array")
+ assert_equal "not-an-array", record.tags
+ e = assert_raises(ActiveRecord::StatementInvalid) do
+ record.save!
+ end
+ assert_instance_of PG::InvalidTextRepresentation, e.original_exception
+ end
+
private
def assert_cycle field, array
# test creation