File tree Expand file tree Collapse file tree 1 file changed +23
-6
lines changed Expand file tree Collapse file tree 1 file changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,21 @@ def clock_time
57
57
end
58
58
end
59
59
60
- config . before :each do
61
- @client = new_client
62
- end
63
-
64
- config . after :each do
65
- @clients . each ( &:close )
60
+ config . before ( :suite ) do
61
+ begin
62
+ new_client
63
+ rescue Mysql2 ::Error => e
64
+ username = DatabaseCredentials [ 'root' ] [ 'username' ]
65
+ database = DatabaseCredentials [ 'root' ] [ 'database' ]
66
+ message = %(
67
+ An error occurred while connecting to the testing database server.
68
+ Make sure that the database server is running.
69
+ Make sure that `mysql -u #{ username } [options] #{ database } ` succeeds by the root user config in spec/configuration.yml.
70
+ Make sure that the testing database '#{ database } ' exists. If it does not exist, create it.
71
+ )
72
+ warn message
73
+ raise e
74
+ end
66
75
end
67
76
68
77
config . before ( :all ) do
@@ -126,4 +135,12 @@ def clock_time
126
135
]
127
136
end
128
137
end
138
+
139
+ config . before ( :each ) do
140
+ @client = new_client
141
+ end
142
+
143
+ config . after ( :each ) do
144
+ @clients . each ( &:close )
145
+ end
129
146
end
You can’t perform that action at this time.
0 commit comments