Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/branches/2-1-caching/activerecord/test/connection_test_mysql.rb

Revision 7667, 0.8 kB (checked in by bitsweat, 1 year ago)

Fixtures test fixes and general cleanup. Closes #9682 [norbert]

Line 
1 require "#{File.dirname(__FILE__)}/abstract_unit"
2
3 class MysqlConnectionTest < Test::Unit::TestCase
4   def setup
5     @connection = ActiveRecord::Base.connection
6   end
7
8   def test_no_automatic_reconnection_after_timeout
9     assert @connection.active?
10     @connection.update('set @@wait_timeout=1')
11     sleep 2
12     assert !@connection.active?
13   end
14
15   def test_successful_reconnection_after_timeout_with_manual_reconnect
16     assert @connection.active?
17     @connection.update('set @@wait_timeout=1')
18     sleep 2
19     @connection.reconnect!
20     assert @connection.active?
21   end
22
23   def test_successful_reconnection_after_timeout_with_verify
24     assert @connection.active?
25     @connection.update('set @@wait_timeout=1')
26     sleep 2
27     @connection.verify!(0)
28     assert @connection.active?
29   end
30 end
Note: See TracBrowser for help on using the browser.