Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Postgresql: add test case for setting custom libpq connection parameters

  • Loading branch information...
commit 8aaf9719dadc3696b939f3429d57973d00df40d9 1 parent 8ee6406
@larskanis authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 activerecord/test/cases/adapters/postgresql/connection_test.rb
View
15 activerecord/test/cases/adapters/postgresql/connection_test.rb
@@ -2,6 +2,9 @@
module ActiveRecord
class PostgresqlConnectionTest < ActiveRecord::TestCase
+ class NonExistentTable < ActiveRecord::Base
+ end
+
def setup
super
@connection = ActiveRecord::Base.connection
@@ -10,5 +13,17 @@ def setup
def test_encoding
assert_not_nil @connection.encoding
end
+
+ # Ensure, we can set connection params using the example of Generic
+ # Query Optimizer (geqo). It is 'on' per default.
+ def test_connection_options
+ params = ActiveRecord::Base.connection_config.dup
+ params[:options] = "-c geqo=off"
+ NonExistentTable.establish_connection(params)
+
+ # Verify the connection param has been applied.
+ expect = NonExistentTable.connection.query('show geqo').first.first
+ assert_equal 'off', expect
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.