diff options
author | Glenn Gillen <me@glenngillen.com> | 2011-06-28 19:10:57 +0100 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-20 16:23:31 -0700 |
commit | 89357c8f834f638210d004ae9426aaa052dd519b (patch) | |
tree | 1e25154b15baff421da517c54c84f25aae3e483c /activerecord/test/cases | |
parent | 22e47279bc5a905b2535b9bbf7061ca72e8d3b71 (diff) | |
download | rails-89357c8f834f638210d004ae9426aaa052dd519b.tar.gz rails-89357c8f834f638210d004ae9426aaa052dd519b.tar.bz2 rails-89357c8f834f638210d004ae9426aaa052dd519b.zip |
Provide database connection settings as a URL.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapter_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 4c65193d75..da57349d93 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -60,6 +60,17 @@ class AdapterTest < ActiveRecord::TestCase assert_equal @connection.show_variable('collation_database'), @connection.collation end + def test_connect_with_url + begin + ar_config = ARTest.connection_config['arunit'] + url = "mysql://#{ar_config["username"]}@localhost/#{ar_config["database"]}" + ActiveRecord::Base.establish_connection(url) + assert_equal ar_config['database'], ActiveRecord::Base.connection.current_database + ensure + ActiveRecord::Base.establish_connection 'arunit' + end + end + def test_show_nonexistent_variable_returns_nil assert_nil @connection.show_variable('foo_bar_baz') end |