#27 new
azimux

test and patch for bug with functional tests and fixtures/tables starting with "test"

Reported by azimux | July 23rd, 2008 @ 01:26 PM

you cannot have fixtures/tables named "test*" and do a fixtures :all in the test_helper because the test runner will notice the public instance methods starting with test (added to the testcase as fixture accessors) and think that it is indeed a testcase and roll it into a suite. The problem with this is you can't have ActionController::TestCase rolled into a test suite because it doesn't have an ActionController associated with it like it's subclasses are expected. The result is an error when it calls the setup callback on ActionController::TestCase itself.

After spending quite some time fighting with the Test::Unit::TestCase that's external to rails, I found it just too inflexible and annoying to mess with. My solution is to have the methods added by fixtures() be protected. Then the test runner doesn't see them and decide to roll the abstract testing classes into test suites and run them.

I have attatched the patches to this ticket. The first patch is a test that demonstrates the bug (it will give an error.) The second patch fixes it.

These are also available as branches at

test: http://github.com/azimux/rails/t...

fix: http://github.com/azimux/rails/t...

if the changes look usable as is, those branches are both safe to pull from (they have no ancestors other than rails/master) if it's easier than applying patches. I really have no clue what's easier.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket