From 9d9aed433bd29eefb14807c02050cb8b88f15f0e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 21 Oct 2010 11:26:16 -0700 Subject: add a session authorization setter to the pg connection --- .../test/cases/adapters/postgresql/schema_authorization_test.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb index 8fdda20f77..dc4f8fb955 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb @@ -43,6 +43,13 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase end end + def test_session_auth= + assert_raise(ActiveRecord::StatementInvalid) do + @connection.session_auth = 'DEFAULT' + @connection.execute "SELECT * FROM #{TABLE_NAME}" + end + end + def test_auth_with_bind assert_nothing_raised do set_session_auth @@ -90,7 +97,7 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase private def set_session_auth auth = nil - @connection.execute "SET SESSION AUTHORIZATION #{auth || 'default'}" + @connection.session_auth = auth || 'default' end end -- cgit v1.2.3