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


#1

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

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

It looks like a bug to me.

Alain


#2

On 12/19/05, Alain R. removed_email_address@domain.invalid 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.


#3

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