Permalink
Browse files

move around tests

  • Loading branch information...
1 parent 1692143 commit f4ed9751251b2e979ee7bf38faf74371e78bbf42 @tenderlove tenderlove committed Jul 21, 2011
Showing with 10 additions and 30 deletions.
  1. +0 −30 activerecord/test/cases/adapter_test.rb
  2. +10 −0 activerecord/test/cases/adapters/mysql/connection_test.rb
@@ -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
@@ -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
@@ -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}))

0 comments on commit f4ed975

Please sign in to comment.