Skip to content

Commit 4acafd5

Browse files
committed
Update testing directions.
1 parent 0532e78 commit 4acafd5

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

RUNNING_UNIT_TESTS

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
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

1315
The 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

4364
Now with that out of the way you can run "bundle install" to hook everything up.

test/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ default_connection: dblib
33
default_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:

0 commit comments

Comments
 (0)