Skip to content

Commit a8d7e98

Browse files
committed
[test] properly isolate mysql_connection unit test
1 parent 795a298 commit a8d7e98

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/db/mysql/unit_test.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,16 @@ def initialize; end
148148
assert_equal false, config[:properties]['useSSL']
149149
end
150150

151-
def load_jdbc_mysql
152-
require 'jdbc/mysql'
153-
rescue LoadError
154-
return nil
155-
end
156-
157151
end
158152

159153
context 'connection (Jdbc::MySQL missing)' do
160154

161155
module ::Jdbc; end
162156

163-
@@jdbc_mysql = ::Jdbc::MySQL rescue nil
164-
157+
@@jdbc_mysql = false
165158
def setup
159+
load_jdbc_mysql
160+
@@jdbc_mysql = ::Jdbc::MySQL rescue nil
166161
::Jdbc.send :remove_const, :MySQL if @@jdbc_mysql
167162
end
168163

@@ -224,4 +219,10 @@ def teardown
224219

225220
end
226221

222+
def load_jdbc_mysql
223+
require 'jdbc/mysql'
224+
rescue LoadError
225+
return nil
226+
end
227+
227228
end if defined? JRUBY_VERSION

0 commit comments

Comments
 (0)