diff options
author | Lars Kanis <kanis@comcard.de> | 2012-01-03 16:58:54 +0100 |
---|---|---|
committer | Lars Kanis <kanis@comcard.de> | 2012-01-04 08:45:53 +0100 |
commit | 8aaf9719dadc3696b939f3429d57973d00df40d9 (patch) | |
tree | 9c57e8731bd9c74c276d1d2c7e7a2f0534027f8a /activerecord/test/cases | |
parent | 8ee6406acc67aa721127d69486bf8e244ea6d576 (diff) | |
download | rails-8aaf9719dadc3696b939f3429d57973d00df40d9.tar.gz rails-8aaf9719dadc3696b939f3429d57973d00df40d9.tar.bz2 rails-8aaf9719dadc3696b939f3429d57973d00df40d9.zip |
Postgresql: add test case for setting custom libpq connection parameters
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/connection_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index 21b97b3b39..4baec749ff 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -2,6 +2,9 @@ require "cases/helper" module ActiveRecord class PostgresqlConnectionTest < ActiveRecord::TestCase + class NonExistentTable < ActiveRecord::Base + end + def setup super @connection = ActiveRecord::Base.connection @@ -10,5 +13,17 @@ module ActiveRecord 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 |