+
+ def test_error_in_nested_transaction_should_retry_outermost_transaction
+ tries = 0
+ errors = 0
+
+ MockModel.transaction do
+ tries += 1
+ MockModel.transaction do
+ MockModel.transaction do
+ errors += 1
+ raise ActiveRecord::StatementInvalid, "MySQL::Error: Lock wait timeout exceeded" unless errors > 3
+ end
+ end
+ end
+
+ assert_equal 4, tries
+ end