aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-07-26 09:19:45 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2015-07-26 09:19:45 +0200
commite90b58106d09af585e85238d7d49cf79f006d4d4 (patch)
tree3106b46294bb0a68c8fcd38dfc053e001a224be3
parent119b9181ece399c67213543fb5227b82688b536f (diff)
parent330f74956763719f86acca8a0337ba320f06fd73 (diff)
downloadrails-e90b58106d09af585e85238d7d49cf79f006d4d4.tar.gz
rails-e90b58106d09af585e85238d7d49cf79f006d4d4.tar.bz2
rails-e90b58106d09af585e85238d7d49cf79f006d4d4.zip
Merge pull request #21030 from yahonda/mysql2_20969
Remove @connection instance variable only when defined
-rw-r--r--activerecord/test/cases/adapters/mysql2/quoting_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/quoting_test.rb b/activerecord/test/cases/adapters/mysql2/quoting_test.rb
index a49cbba4b4..92221e61bf 100644
--- a/activerecord/test/cases/adapters/mysql2/quoting_test.rb
+++ b/activerecord/test/cases/adapters/mysql2/quoting_test.rb
@@ -7,14 +7,14 @@ class Mysql2QuotingTest < ActiveRecord::Mysql2TestCase
test 'quoted date precision for gte 5.6.4' do
@connection.stubs(:full_version).returns('5.6.4')
- @connection.remove_instance_variable(:@version)
+ @connection.remove_instance_variable(:@version) if @connection.instance_variable_defined?(:@version)
t = Time.now.change(usec: 1)
assert_match(/\.000001\z/, @connection.quoted_date(t))
end
test 'quoted date precision for lt 5.6.4' do
@connection.stubs(:full_version).returns('5.6.3')
- @connection.remove_instance_variable(:@version)
+ @connection.remove_instance_variable(:@version) if @connection.instance_variable_defined?(:@version)
t = Time.now.change(usec: 1)
refute_match(/\.000001\z/, @connection.quoted_date(t))
end