Skip to content

Commit 0532e78

Browse files
committed
Document more simple testing setup.
1 parent 5c75226 commit 0532e78

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

RUNNING_UNIT_TESTS

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11

2+
= TL;DR
3+
4+
* Setup two databases in SQL Server, [activerecord_unittest] and [activerecord_unittest2]
5+
* Create a [rails] user with an empty password and give it admin perms to both DBs.
6+
* $ git clone git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git
7+
* $ bundle install
8+
* $ bundle exec rake test
9+
10+
211
= Creating the test databases
312

413
The default names for the test databases are "activerecord_unittest" and
@@ -21,36 +30,44 @@ Clone adapter git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.gi
2130
The master branch is the one under development for rails 3, track the repos 2-3-stable
2231
branch for 2.x development.
2332

24-
The tests of this adapter depend on the existence of the rails which can be cloned at
25-
git://github.com/rails/rails.git
33+
The tests of this adapter depend on the existence of the rails which under the 3.1
34+
version and above is automatically cloned for you with bundler. However you can clone
35+
rails from git://github.com/rails/rails.git and set the RAILS_SOURCE environment
36+
variable so bundler will use another local path instead.
2637

27-
Once you have cloned these repos set the RAILS_SOURCE environment variable to its
28-
full path. For instance:
38+
$ git clone git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git
2939

30-
∴ echo $RAILS_SOURCE
31-
/Users/kencollins/Repositories/rails
32-
33-
Do not forget to checkout the version tags of each repo that match either our gemspec
34-
or what version your tests target. For instance, v3.0.3 tag for Rails/ActiveRecord.
40+
41+
= Bundling
42+
43+
Now with that out of the way you can run "bundle install" to hook everything up.
44+
Our tests use bundler to setup the load paths correctly. The default mode is DBLIB
45+
using TinyTDS. It is important to use bundle exec so we can wire up the ActiveRecord
46+
test libs correctly.
47+
48+
$ bundle exec rake test
3549

3650

37-
= Setup Connection Mode
51+
= Testing Options
3852

3953
The Gemfile contains groups for :tinytds and :odbc. By default it will install both gems
4054
which allows you to run the full test suite in either connection mode. If for some reason
41-
any one of these is problematic or of no concern, you could always for go the bundling
42-
of those gems with something like this.
55+
any one of these is problematic or of no concern, you could always opt out of bundling
56+
either gem with something like this.
4357

44-
bundle install --without odbc
58+
$ bundle install --without odbc
4559

60+
You can run different connection modes using the following rake commands. Again, the
61+
DBLIB connection mode using TinyTDS is the default test task.
4662

47-
= Finally
63+
$ bundle exec rake test:dblib
64+
$ bundle exec rake test:odbc
4865

49-
Now with all that out of the way you can run "bundle install" to hook everything up.
50-
Our tests use bundler to setup the load paths correctly. If all goes well, you should
51-
be able to run "rake test:dblib" which will load all the adapter tests followed by the
52-
core ActiveRecord tests. Lastly, it is typically good practice to do your work
53-
on a local branch of our remote tracking branch.
66+
By default, Bundler will download the rails git repo and use the git tag that matches
67+
the dependency version in our gemspec. If you want to test another version of rails,
68+
you can either temporarily change the :tag for rails in the Gemfile. Likewise, you can
69+
clone the rails repo your self to another directory and use the RAILS_SOURCE environment
70+
variable.
5471

5572

5673
= Current Expected Failures

0 commit comments

Comments
 (0)