diff options
-rw-r--r-- | activerecord/test/cases/adapter_test.rb | 30 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/mysql/connection_test.rb | 10 |
2 files changed, 10 insertions, 30 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index b1d99960fe..3942e7bb41 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -60,17 +60,6 @@ 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 @@ -92,25 +81,6 @@ class AdapterTest < ActiveRecord::TestCase end end - if current_adapter?(:PostgreSQLAdapter) - 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["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 def @connection.test_table_alias_length() 10; end class << @connection diff --git a/activerecord/test/cases/adapters/mysql/connection_test.rb b/activerecord/test/cases/adapters/mysql/connection_test.rb index eee771ecff..2a89430da9 100644 --- a/activerecord/test/cases/adapters/mysql/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql/connection_test.rb @@ -13,6 +13,16 @@ class MysqlConnectionTest < ActiveRecord::TestCase end end + def test_connect_with_url + run_without_connection do |orig| + ar_config = ARTest.connection_config['arunit'] + url = "mysql://#{ar_config["username"]}@localhost/#{ar_config["database"]}" + klass = Class.new(ActiveRecord::Base) + klass.establish_connection(url) + assert_equal ar_config['database'], klass.connection.current_database + end + end + def test_mysql_reconnect_attribute_after_connection_with_reconnect_false run_without_connection do |orig_connection| ActiveRecord::Base.establish_connection(orig_connection.merge({:reconnect => false})) |