aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2015-07-26 01:09:05 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2015-07-26 01:09:05 +0000
commit330f74956763719f86acca8a0337ba320f06fd73 (patch)
tree3106b46294bb0a68c8fcd38dfc053e001a224be3 /activerecord/test
parent119b9181ece399c67213543fb5227b82688b536f (diff)
downloadrails-330f74956763719f86acca8a0337ba320f06fd73.tar.gz
rails-330f74956763719f86acca8a0337ba320f06fd73.tar.bz2
rails-330f74956763719f86acca8a0337ba320f06fd73.zip
Remove @connection instance variable only when defined
Diffstat (limited to 'activerecord/test')
-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