aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/array_test.rb8
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb8
-rw-r--r--activerecord/test/cases/adapters/postgresql/json_test.rb8
3 files changed, 18 insertions, 6 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb
index cf059d20e2..d71e2aa2bb 100644
--- a/activerecord/test/cases/adapters/postgresql/array_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/array_test.rb
@@ -129,9 +129,13 @@ class PostgresqlArrayTest < ActiveRecord::TestCase
end
def test_update_all
- PgArray.create! tags: ["one", "two", "three"]
+ pg_array = PgArray.create! tags: ["one", "two", "three"]
+
PgArray.update_all tags: ["four", "five"]
- assert_equal ["four", "five"], PgArray.first.tags
+ assert_equal ["four", "five"], pg_array.reload.tags
+
+ PgArray.update_all tags: []
+ assert_equal [], pg_array.reload.tags
end
private
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index 730020b5c8..6df5d8f533 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -208,9 +208,13 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
end
def test_update_all
- Hstore.create! tags: { "one" => "two" }
+ hstore = Hstore.create! tags: { "one" => "two" }
+
Hstore.update_all tags: { "three" => "four" }
- assert_equal({ "three" => "four" }, Hstore.first.tags)
+ assert_equal({ "three" => "four" }, hstore.reload.tags)
+
+ Hstore.update_all tags: { }
+ assert_equal({ }, hstore.reload.tags)
end
end
diff --git a/activerecord/test/cases/adapters/postgresql/json_test.rb b/activerecord/test/cases/adapters/postgresql/json_test.rb
index 10efa8b802..01e7334aad 100644
--- a/activerecord/test/cases/adapters/postgresql/json_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/json_test.rb
@@ -123,8 +123,12 @@ class PostgresqlJSONTest < ActiveRecord::TestCase
end
def test_update_all
- JsonDataType.create! payload: { "one" => "two" }
+ json = JsonDataType.create! payload: { "one" => "two" }
+
JsonDataType.update_all payload: { "three" => "four" }
- assert_equal({ "three" => "four" }, JsonDataType.first.payload)
+ assert_equal({ "three" => "four" }, json.reload.payload)
+
+ JsonDataType.update_all payload: { }
+ assert_equal({ }, json.reload.payload)
end
end