move around tests

This commit is contained in:
Aaron Patterson
2011-07-21 11:54:29 -07:00
parent 16921437a1
commit f4ed975125
2 changed files with 10 additions and 30 deletions

View File

@@ -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

View File

@@ -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}))