I have just migrated to use Rail 1.1 from 1.0.
In the progress of fixing and cleaning up the unit tests. I found the
following problem. I am not sure if this is a bug or it is my
environment.
When I run "rake test_units, some of the index in association tables is
not created, this leads to failures for some unit test cases.
Thinking that may be because I didn’t setup the database correctly, I
reload the sql file (with the index defined) into both test and
development database.
run the test mannually, i.e. ruby test/units/myclass_test.rb works fine.
But when I invoke rake test_units to run all unit tests in a batch, I
have the same problem again. It seems db/schema.rb generated from the
rake test_units has missed some of the indexes definition for some of
the tables.
Anyone know where I should look to locate the problem? It only occurs to
some of the tables not all of them. So I think it must be something
wrong with some of my code somewhere… Thanks in advance.
I had the same problem once. Just run your test_units manually. I think
there’s a problem with rake test_units. I bet that your functional test
run
just fine with rake, isn’t it?
On 6/2/06, Chester C. [email protected] wrote:
reload the sql file (with the index defined) into both test and
development database.
run the test mannually, i.e. ruby test/units/myclass_test.rb works fine.
I have had a similar problem myself, recently. My project has a number
of
migrations. When I run rake test:units, it seems to revert to a previous
migration and wipes out the latest. The schema_info bit, however, would
not
be updated to point at a previous generation, even though the migration
appeared to be rolled back.
I thought schema.rb might be to blame - does Rake recreate the test
database
with that?
Ioana K. wrote:
I had the same problem once. Just run your test_units manually. I think
there’s a problem with rake test_units. I bet that your functional test
run
just fine with rake, isn’t it?
Yup, functional test runs fine.