[Bug?] in tests, @foo.bars_count <> @foo.bars.count

Example: if a ‘foo’ has 3 ‘bars’,

bars_count == “0” # ERROR
bars.count == 3 # OK

It looks like a bug to me.

Alain

On 12/19/05, Alain R. [email protected] wrote:

Example: if a ‘foo’ has 3 ‘bars’,

bars_count == “0” # ERROR
bars.count == 3 # OK

And what about collection.size and collection_count? Which should be
used
and in what case?

It looks like a bug to me.

Alain R. wrote:

bars_count == “0” # ERROR
bars.count == 3 # OK

I should have added that I use a count cache on the “foo” table.
=> there is a “bars_count” column in the ‘foo’ table,
BUT
I didn’t initialize it, as the bars are added in another fixture:
bars.yml

=> my test class starts with
fixture :foos, :bars

It looks like counters caches are not initialized by fixtures.

Alain