Forum: Ruby on Rails Wierdness with rake test_units and schema.rb

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chester C. (Guest)
on 2006-06-02 22:28
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.
Ioana K. (Guest)
on 2006-06-02 23:15
(Received via mailing list)
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?
Justin B. (Guest)
on 2006-06-02 23:33
(Received via mailing list)
On 6/2/06, Chester C. <removed_email_address@domain.invalid> 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?
Chester C. (Guest)
on 2006-06-03 00:40
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.
This topic is locked and can not be replied to.