Skip to content

Commit f0970d7

Browse files
committed
Merge pull request #335 from dbussink/master
Use string key for alternative hostname
2 parents bbe52ea + fda9f67 commit f0970d7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spec/mysql2/client_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
lambda {
1111
# The odd local host IP address forces the mysql client library to
1212
# use a TCP socket rather than a domain socket.
13-
Mysql2::Client.new DatabaseCredentials['root'].merge(:host => '127.0.0.2', :port => 999999)
13+
Mysql2::Client.new DatabaseCredentials['root'].merge('host' => '127.0.0.2', 'port' => 999999)
1414
}.should raise_error(Mysql2::Error)
1515
end
1616

@@ -293,13 +293,17 @@ def connect *args
293293

294294
it "threaded queries should be supported" do
295295
threads, results = [], {}
296+
lock = Mutex.new
296297
connect = lambda{
297298
Mysql2::Client.new(DatabaseCredentials['root'])
298299
}
299300
Timeout.timeout(0.7) do
300301
5.times {
301302
threads << Thread.new do
302-
results[Thread.current.object_id] = connect.call.query("SELECT sleep(0.5) as result")
303+
result = connect.call.query("SELECT sleep(0.5) as result")
304+
lock.synchronize do
305+
results[Thread.current.object_id] = result
306+
end
303307
end
304308
}
305309
end

0 commit comments

Comments
 (0)