File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 11
22= TL;DR
33
4+ Default testing uses DBLIB with TinyTDS.
5+
46 * Setup two databases in SQL Server, [activerecord_unittest] and [activerecord_unittest2]
57 * Create a [rails] user with an empty password and give it admin perms to both DBs.
68 * $ git clone git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git
79 * $ bundle install
8- * $ bundle exec rake test
10+ * $ bundle exec rake test ACTIVERECORD_UNITTEST_HOST='my.db.net'
11+
912
10-
1113= Creating the test databases
1214
1315The default names for the test databases are "activerecord_unittest" and
@@ -38,6 +40,25 @@ variable so bundler will use another local path instead.
3840 $ git clone git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git
3941
4042
43+ = Configure DB Connection
44+
45+ Please consult the test/config.yml file which is used to parse the configuration options
46+ for the DB connections when running tests. This file has overrides for any connection mode
47+ that you can set using simple environment variables. Assuming you are using FreeTDS 0.91
48+ and above
49+
50+ $ export ACTIVERECORD_UNITTEST_HOST='my.db.net' # Defaults to localhost
51+ $ export ACTIVERECORD_UNITTEST_PORT='1533' # Defaults to 1433
52+
53+ If you have FreeTDS 0.82 installed and/or want to use a named dataserver in your freetds.conf file
54+
55+ $ export ACTIVERECORD_UNITTEST_DATASERVER='mydbname'
56+
57+ These can be passed down to rake too.
58+
59+ $ bundle exec rake test ACTIVERECORD_UNITTEST_HOST='my.db.net'
60+
61+
4162= Bundling
4263
4364Now with that out of the way you can run "bundle install" to hook everything up.
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ default_connection: dblib
33default_connection_info : &default_connection_info
44 adapter : sqlserver
55 mode : <%= ENV['ARCONN'] || 'dblib' %>
6- host : <%= ENV['ACTIVERECORD_UNITTEST_DATASERVER'] || 'localhost' %>
6+ host : <%= ENV['ACTIVERECORD_UNITTEST_HOST'] || 'localhost' %>
7+ port : <%= ENV['ACTIVERECORD_UNITTEST_PORT'] %>
78 database : activerecord_unittest
89 username : <%= ENV['ACTIVERECORD_UNITTEST_USER'] || 'rails' %>
910 password : <%= ENV['ACTIVERECORD_UNITTEST_PASS'] || '' %>
@@ -15,10 +16,12 @@ connections:
1516 arunit :
1617 << : *default_connection_info
1718 appname : SQLServerAdptrUnit
19+ dataserver : <%= ENV['ACTIVERECORD_UNITTEST_DATASERVER'] %>
1820 arunit2 :
1921 << : *default_connection_info
2022 database : activerecord_unittest2
2123 appname : SQLServerAdptrUnit2
24+ dataserver : <%= ENV['ACTIVERECORD_UNITTEST_DATASERVER'] %>
2225
2326 odbc :
2427 arunit :
You can’t perform that action at this time.
0 commit comments