diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-06-25 13:29:17 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-06-25 14:47:14 -0700 |
commit | 5e2b473b478d93d6a1aa627d688b2b2ce05fa9ef (patch) | |
tree | c0778a2075f34feeec6f52426055e88280529e26 /activerecord/test/cases/connection_test_mysql.rb | |
parent | efbd0eb9f7508187259208caf6b51eec206cbac9 (diff) | |
download | rails-5e2b473b478d93d6a1aa627d688b2b2ce05fa9ef.tar.gz rails-5e2b473b478d93d6a1aa627d688b2b2ce05fa9ef.tar.bz2 rails-5e2b473b478d93d6a1aa627d688b2b2ce05fa9ef.zip |
reorganizing adapter specific tests. [#4974 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test/cases/connection_test_mysql.rb')
-rw-r--r-- | activerecord/test/cases/connection_test_mysql.rb | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/activerecord/test/cases/connection_test_mysql.rb b/activerecord/test/cases/connection_test_mysql.rb deleted file mode 100644 index 8e4842a1b6..0000000000 --- a/activerecord/test/cases/connection_test_mysql.rb +++ /dev/null @@ -1,64 +0,0 @@ -require "cases/helper" - -class MysqlConnectionTest < ActiveRecord::TestCase - def setup - super - @connection = ActiveRecord::Base.connection - end - - def test_mysql_reconnect_attribute_after_connection_with_reconnect_true - run_without_connection do |orig_connection| - ActiveRecord::Base.establish_connection(orig_connection.merge({:reconnect => true})) - assert ActiveRecord::Base.connection.raw_connection.reconnect - 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})) - assert !ActiveRecord::Base.connection.raw_connection.reconnect - end - end - - def test_no_automatic_reconnection_after_timeout - assert @connection.active? - @connection.update('set @@wait_timeout=1') - sleep 2 - assert !@connection.active? - end - - def test_successful_reconnection_after_timeout_with_manual_reconnect - assert @connection.active? - @connection.update('set @@wait_timeout=1') - sleep 2 - @connection.reconnect! - assert @connection.active? - end - - def test_successful_reconnection_after_timeout_with_verify - assert @connection.active? - @connection.update('set @@wait_timeout=1') - sleep 2 - @connection.verify! - assert @connection.active? - end - - # Test that MySQL allows multiple results for stored procedures - if Mysql.const_defined?(:CLIENT_MULTI_RESULTS) - def test_multi_results - rows = ActiveRecord::Base.connection.select_rows('CALL ten();') - assert_equal 10, rows[0][0].to_i, "ten() did not return 10 as expected: #{rows.inspect}" - end - end - - private - - def run_without_connection - original_connection = ActiveRecord::Base.remove_connection - begin - yield original_connection - ensure - ActiveRecord::Base.establish_connection(original_connection) - end - end -end |