aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDylan Thacker-Smith <Dylan.Smith@shopify.com>2017-01-09 14:34:18 -0500
committerDylan Thacker-Smith <Dylan.Smith@shopify.com>2017-01-09 14:54:42 -0500
commita01a3fa608af19fff8e0491cd4e6ad18943c8010 (patch)
treebe3a34e2beafdd07ccb9affa3ad70b95da63e006 /activerecord
parent3bc747bd8676dc940b531067e2861dcd4ac28efc (diff)
downloadrails-a01a3fa608af19fff8e0491cd4e6ad18943c8010.tar.gz
rails-a01a3fa608af19fff8e0491cd4e6ad18943c8010.tar.bz2
rails-a01a3fa608af19fff8e0491cd4e6ad18943c8010.zip
activerecord/test: Fix Mysql2ConnectionTest#test_execute_after_disconnect
Mysql2ConnectionTest#test_execute_after_disconnect was originally added to catch a NoMethodError occuring in execute when the Mysql2Adapter has a nil `@connection`. Pull request #26869 removed the error message check in that test because the error message changed in the mysql2 gem, which caused the test to fail. Now the test wouldn't catch the original bug since the NoMethodError would get turned into a ActiveRecord::StatementInvalid exception. Check the cause of the StatementInvalid exception to make sure it is of the correct type.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/adapters/mysql2/connection_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb
index c1de2218e2..bae283a048 100644
--- a/activerecord/test/cases/adapters/mysql2/connection_test.rb
+++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb
@@ -66,9 +66,10 @@ class Mysql2ConnectionTest < ActiveRecord::Mysql2TestCase
def test_execute_after_disconnect
@connection.disconnect!
- assert_raise(ActiveRecord::StatementInvalid) do
+ error = assert_raise(ActiveRecord::StatementInvalid) do
@connection.execute("SELECT 1")
end
+ assert_kind_of Mysql2::Error, error.cause
end
def test_quote_after_disconnect