aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-27 13:42:02 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-27 16:10:03 -0700
commitb06f64c3480cd389d14618540d62da4978918af0 (patch)
tree626a163d2885fd3b91e58c6bcbf60ec3824a51f0 /activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb
parentd66ffb656e0cfbb4216f030c8e0669509567e362 (diff)
downloadrails-b06f64c3480cd389d14618540d62da4978918af0.tar.gz
rails-b06f64c3480cd389d14618540d62da4978918af0.tar.bz2
rails-b06f64c3480cd389d14618540d62da4978918af0.zip
Remove Relation#bind_params
`bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb
index 99c26c4bf7..6937145439 100644
--- a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb
@@ -55,7 +55,7 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase
set_session_auth
USERS.each do |u|
set_session_auth u
- assert_equal u, @connection.exec_query("SELECT name FROM #{TABLE_NAME} WHERE id = $1", 'SQL', [[nil, 1]]).first['name']
+ assert_equal u, @connection.exec_query("SELECT name FROM #{TABLE_NAME} WHERE id = $1", 'SQL', [bind_param(1)]).first['name']
set_session_auth
end
end
@@ -67,7 +67,7 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase
USERS.each do |u|
@connection.clear_cache!
set_session_auth u
- assert_equal u, @connection.exec_query("SELECT name FROM #{TABLE_NAME} WHERE id = $1", 'SQL', [[nil, 1]]).first['name']
+ assert_equal u, @connection.exec_query("SELECT name FROM #{TABLE_NAME} WHERE id = $1", 'SQL', [bind_param(1)]).first['name']
set_session_auth
end
end
@@ -111,4 +111,7 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase
@connection.session_auth = auth || 'default'
end
+ def bind_param(value)
+ ActiveRecord::Relation::QueryAttribute.new(nil, value, ActiveRecord::Type::Value.new)
+ end
end