Skip to content

Commit 0041454

Browse files
committed
Fix the connection exception spec by forcing mysql library to use TCP to localhost in a way that will fail.
1 parent de82622 commit 0041454

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spec/mysql2/client_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
it "should raise an exception upon connection failure" do
1010
lambda {
11-
Mysql2::Client.new DatabaseCredentials['root'].merge(:port => 999999)
11+
# The odd local host IP address forces the mysql client library to
12+
# use a TCP socket rather than a domain socket.
13+
Mysql2::Client.new DatabaseCredentials['root'].merge(:host => '127.0.0.2', :port => 999999)
1214
}.should raise_error(Mysql2::Error)
1315
end
1416

0 commit comments

Comments
 (0)