diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-25 19:32:14 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-26 07:57:03 -0600 |
commit | 58d38d6df2d7f1c1730a3f691a78b3037defa9e7 (patch) | |
tree | 1133327160ae4ec6298034a1e659e6e881a85294 /activerecord/test/cases/adapters/postgresql/array_test.rb | |
parent | e8003c7274c4049f409740b587e4e9e1f3df37f7 (diff) | |
download | rails-58d38d6df2d7f1c1730a3f691a78b3037defa9e7.tar.gz rails-58d38d6df2d7f1c1730a3f691a78b3037defa9e7.tar.bz2 rails-58d38d6df2d7f1c1730a3f691a78b3037defa9e7.zip |
Consolidate testing of update_all type casting
We have several test cases on "tricky" types that are essentially
testing that `update_all` goes through the same type casting behavior as
a normal assignment + save. We recently had another case to add this
test for another type in https://github.com/rails/rails/pull/12742.
Rather than testing this separately for every type which is "tricky"
when round tripping, let's instead have a fairly exhaustive test that
ensures we're getting the correct values at every step for `update_all`.
Given the structure of the code now, we can be confident that if the
type is correct, and `update_all` is type casting correctly, we're going
to get the right behavior for all types.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/array_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/array_test.rb | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb index a51d5e9d31..70585e0148 100644 --- a/activerecord/test/cases/adapters/postgresql/array_test.rb +++ b/activerecord/test/cases/adapters/postgresql/array_test.rb @@ -192,16 +192,6 @@ class PostgresqlArrayTest < ActiveRecord::TestCase assert_equal("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]", record.attribute_for_inspect(:ratings)) end - def test_update_all - pg_array = PgArray.create! tags: ["one", "two", "three"] - - PgArray.update_all tags: ["four", "five"] - assert_equal ["four", "five"], pg_array.reload.tags - - PgArray.update_all tags: [] - assert_equal [], pg_array.reload.tags - end - def test_escaping unknown = 'foo\\",bar,baz,\\' tags = ["hello_#{unknown}"] |