Skip to content

Commit 890c539

Browse files
BanzaiMansodabrew
authored andcommitted
Test connecting to DB with numeric-only name
1 parent 6615449 commit 890c539

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

spec/configuration.yml.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ user:
99
username: LOCALUSERNAME
1010
password:
1111
database: mysql2_test
12+
13+
numericuser:
14+
host: localhost
15+
username: LOCALUSERNAME
16+
password:
17+
database: 12345

spec/mysql2/client_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ def connect *args
104104
ssl_client.close
105105
end
106106

107+
it "should be able to connect to database with numeric-only name" do
108+
lambda {
109+
creds = DatabaseCredentials['numericuser']
110+
@client.query "CREATE DATABASE IF NOT EXISTS `#{creds['database']}`"
111+
@client.query "GRANT ALL ON `#{creds['database']}`.* TO #{creds['username']}@`#{creds['host']}`"
112+
client = Mysql2::Client.new creds
113+
@client.query "DROP DATABASE IF EXISTS `#{creds['database']}`"
114+
}.should_not raise_error
115+
end
116+
107117
it "should respond to #close" do
108118
@client.should respond_to(:close)
109119
end

0 commit comments

Comments
 (0)