Skip to content

Commit bca3f44

Browse files
committed
Add info for required gems for testing. Created section on how to use autotest. Remove expect failures that do not fail anymore. Add a new expected failure with link to lighthouse issue
1 parent 839257f commit bca3f44

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

RUNNING_UNIT_TESTS

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ test/connections/<your database>/connection.rb.
88

99
== Requirements
1010

11+
The following gems need to be installed. Make sure you have gems.github.com as a
12+
source. http://github.com/blog/97-github-loves-rubygems-1-2
13+
14+
* gem install thoughbot-shoulda
15+
* gem install mocha
16+
1117
The tests of this adapter depend on the existence of rails edge. All the tests
1218
defined by rails edge are re-used. For this to work the following directory
1319
structure is assumed to exist:
@@ -31,6 +37,18 @@ of rake tasks with "rake -T"
3137
Rake can be found at http://rake.rubyforge.org
3238

3339

40+
== Running with Autotest
41+
42+
Using autotest is easy, just run "autotest" and the tests will run continually in the
43+
same order as the rake test command. By default autotest will use ODBC connection. If
44+
you want to change this you can edit the autotest/sqlserver.rb file and set odbc_mode
45+
to false.
46+
47+
Lastly, you can run autotest on just the adapter specific tests with "autotest sqlserver".
48+
This will continuously run ONLY the SQL Sever specific behavior tests which are much
49+
quicker to run than the entire active record test suite.
50+
51+
3452
== Running by hand
3553

3654
Unit tests are located in test directory. If you only want to run a single test suite,
@@ -40,6 +58,7 @@ you can do so with:
4058

4159
That'll run the base suite using the SQLServer-Ruby adapter.
4260

61+
4362
== Expected Errors and Failures
4463

4564
Currently we expect the following errors from running the test suite:
@@ -51,20 +70,13 @@ Currently we expect the following errors from running the test suite:
5170
2. ERROR in test_add_limit_offset_should_sanitize_sql_injection_for_limit_without_comas
5271
from
5372
activerecord/test/cases/adapter_test.rb
54-
55-
3. FAILURE in test_update
56-
from
57-
activerecord/test/cases/mixin_test.rb
5873

59-
4. FAILURE in test_create
60-
from
61-
activerecord/test/cases/mixin_test.rb
62-
63-
5. FAILURE in test_many_updates
64-
from
65-
activerecord/test/cases/mixin_test.rb
66-
67-
74+
3. Error:
75+
test_delegates_finds_and_calculations_to_the_base_class(NamedScopeTest):
76+
NoMethodError: undefined method `to_d' for 0:Fixnum
77+
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1346-coerce-0-average-calculation-to-float
78+
79+
6880
1. & 2. error because we treat the possible values for offset and limit much more
6981
aggressively than the intention of the tests. Rails expects that limit => '1,7 bad sql'
7082
would turn into ' limit 1,7' but that's not valid SQL Server syntax so why should we
@@ -74,13 +86,4 @@ to sanitize them. It's a hard-line to take on sql injection, but probably a saf
7486
We do however have our own offset and limit tests in test/cases/offset_and_limit_test_sqlserver
7587
that test our expected behaviour.
7688

77-
3., 4., & 5. error because SQLServer datetimes (the only time data type available) does not
78-
store usec values so even storing a fixed Time value in the db and comparing the retrieved
79-
value to the know value will not work. The retreived value will always have .usec = 0 (probably).
80-
81-
We do however have re-implement the fixed time stuff for activerecord/test/cases/mixin_test.rb in
82-
test/cases/mixin_for_sqlserver_test so that the fixed time is a time with 0 usecs.
83-
84-
NOTE: Neither do quite a few other adapters. I found that our implementation if the
85-
reason for these failures. Have not debuged yet.
8689

0 commit comments

Comments
 (0)