aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorGlenn Gillen <me@glenngillen.com>2011-06-28 19:47:54 +0100
committerAaron Patterson <aaron.patterson@gmail.com>2011-07-20 16:23:31 -0700
commit16249feaab136326ce1a74bb5602517d8d161b6b (patch)
tree49b8cd163ed68dacd3060ddf17986bdf8135800f /activerecord/test
parent89357c8f834f638210d004ae9426aaa052dd519b (diff)
downloadrails-16249feaab136326ce1a74bb5602517d8d161b6b.tar.gz
rails-16249feaab136326ce1a74bb5602517d8d161b6b.tar.bz2
rails-16249feaab136326ce1a74bb5602517d8d161b6b.zip
Added test for postgres connections as URL. Fixed query param parsing.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapter_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb
index da57349d93..52496bf221 100644
--- a/activerecord/test/cases/adapter_test.rb
+++ b/activerecord/test/cases/adapter_test.rb
@@ -96,6 +96,19 @@ class AdapterTest < ActiveRecord::TestCase
def test_encoding
assert_not_nil @connection.encoding
end
+
+ def test_connect_with_url
+ begin
+ ar_config = ARTest.connection_config['arunit']
+ url = "postgres://#{ar_config["username"]}@localhost/#{ar_config["database"]}?encoding=utf8"
+ ActiveRecord::Base.establish_connection(url)
+ connection = ActiveRecord::Base.connection
+ assert_equal ar_config['database'], connection.current_database
+ assert_equal "UTF8", connection.encoding
+ ensure
+ ActiveRecord::Base.establish_connection 'arunit'
+ end
+ end
end
def test_table_alias