Ok, my patch for ticket 3606 has been completely re-written. Now, if
you need to access ActiveRecord, you can do it by extending
ActiveRecordTestCase like so:
require 'active_record_unit'
require 'fixtures/post'
class PaginationTest < ActiveRecordTestCase
fixtures :posts
...
end
It allows for localized (within ActionPack) fixtures and database
schemas and uses only one in memory database for all of the
ActiveRecordTestCase subclasses.
Koz and I have discussed what should happen to test cases when a
connection can't be made for some reason, but we need to make a
choice. Right now, my code will report a connection problem and an
exception if one occured and then abort all the tests (within an
ActiveRecordTestCase) by redefining them with no bodies. Should this
be the behavior? Is there something better?
I'm also getting one bug that I could use some help trying to track
down. When you run a file or a collection of files with an
ActiveRecordTestCase, you get one failure: the default_test failure
for when no tests are defined.
By using printf debugging in the Test::Unit library itself
(Test::Unit::TestSuite#run), I've found that ActiveRecordTestCase is
run as a suite in addition to it's subclass. Here's a dump that may
help:
SQLite 3 unavailable; falling to SQLite 2.
Loaded suite controller/active_record_assertions_test
Started
Running controller/active_record_assertions_test
Running ActiveRecordAssertionsControllerTest
....Running ActiveRecordTestCase
F
Finished in 0.242251 seconds.
1) Failure:
default_test(ActiveRecordTestCase)
[/usr/local/lib/ruby/1.8/test/unit/assertions.rb:30:in `assert_block'
/usr/local/lib/ruby/1.8/test/unit/assertions.rb:28:in `_wrap_assertion'
/usr/local/lib/ruby/1.8/test/unit/assertions.rb:28:in `assert_block'
/usr/local/lib/ruby/1.8/test/unit/assertions.rb:225:in `flunk'
/usr/local/lib/ruby/1.8/test/unit/testcase.rb:99:in `default_test'
/usr/local/lib/ruby/1.8/test/unit/testcase.rb:70:in `__send__'
/usr/local/lib/ruby/1.8/test/unit/testcase.rb:70:in `run'
/usr/local/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/local/lib/ruby/1.8/test/unit/testsuite.rb:32:in `each'
/usr/local/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'
/usr/local/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/local/lib/ruby/1.8/test/unit/testsuite.rb:32:in `each'
/usr/local/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'
/usr/local/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:44:in
`run_suite'
/usr/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:65:in
`start_mediator'
/usr/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:39:in `start'
/usr/local/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:27:in `run'
/usr/local/lib/ruby/1.8/test/unit/autorunner.rb:194:in `run'
/usr/local/lib/ruby/1.8/test/unit/autorunner.rb:14:in `run'
/usr/local/lib/ruby/1.8/test/unit.rb:285
/usr/local/lib/ruby/1.8/test/unit.rb:283]:
No tests were specified.
5 tests, 45 assertions, 1 failures, 0 errors
Thanks in advance,
Kev
_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core