aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-12-20 08:45:54 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-12-23 16:28:35 -0200
commit9e1740af9c1a00980b30c66aba3c223c33e646e4 (patch)
tree0ad9eb3cb5820bf8b6c117a69c307b0c678f4002 /activerecord/test
parent73bba4c1e1f7fa23aa1a126971338d94ae42398f (diff)
downloadrails-9e1740af9c1a00980b30c66aba3c223c33e646e4.tar.gz
rails-9e1740af9c1a00980b30c66aba3c223c33e646e4.tar.bz2
rails-9e1740af9c1a00980b30c66aba3c223c33e646e4.zip
Tidy up fix for PG extensions quoting
Always pass in the column for quote_bound_value and quote using it in case it exists there.
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