Skip to content

Commit

Permalink
move around tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jul 21, 2011
1 parent 1692143 commit f4ed975
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 deletions.
30 changes: 0 additions & 30 deletions activerecord/test/cases/adapter_test.rb
Expand Up @@ -60,17 +60,6 @@ def test_collation
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
Expand All @@ -92,25 +81,6 @@ def test_not_specifying_database_name_for_cross_database_selects
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
Expand Down
10 changes: 10 additions & 0 deletions activerecord/test/cases/adapters/mysql/connection_test.rb
Expand Up @@ -13,6 +13,16 @@ def test_mysql_reconnect_attribute_after_connection_with_reconnect_true
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}))
Expand Down

0 comments on commit f4ed975

Please sign in to comment.