Forums » Rails-core » Tests Broken!

Tests Broken!
Posted by Hampton (Guest)
on 25.06.2006 01:07
Looks like some changes made in the Ennumerable extensions had some
majorly negative effects on the Summing ability of AR.

Sample Errors off mysql:

  2) Error:
test_should_group_by_summed_field_with_conditions_and_having(CalculationsTest):
ArgumentError: wrong number of arguments (2 for 0)
    ./test/../lib/active_record/associations/association_proxy.rb:123:in 
`sum'
    ./test/../lib/active_record/associations/association_proxy.rb:123:in
`method_missing'
    ./test/../lib/active_record/associations/has_many_association.rb:95:in
`method_missing'
    ./test/calculations_test.rb:166:in
`test_should_group_by_summed_field_with_conditions_and_having'

  3) Error:
test_should_sum_scoped_field(CalculationsTest):
ArgumentError: wrong number of arguments (1 for 0)
    ./test/../lib/active_record/associations/association_proxy.rb:123:in 
`sum'
    ./test/../lib/active_record/associations/association_proxy.rb:123:in
`method_missing'
    ./test/../lib/active_record/associations/has_many_association.rb:95:in
`method_missing'
    ./test/calculations_test.rb:152:in `test_should_sum_scoped_field'

Working on a way around this right now....

-hampton.
Re: Tests Broken!
Posted by Coda Hale (Guest)
on 25.06.2006 02:27
On 6/24/06, Hampton <hcatlin@gmail.com> wrote:
> Looks like some changes made in the Ennumerable extensions had some
> majorly negative effects on the Summing ability of AR.

Enumerable#sum was overriding AR::Calculations#sum. I opened a ticket
for this (#5500 [http://dev.rubyonrails.org/ticket/5500]) with a patch
which manually routes #sum to #calculate in AssociationCollection. The
unit tests all pass now (MySQL).
Re: Tests Broken!
Posted by Hampton (Guest)
on 25.06.2006 20:40
This patch fixes the errors I was getting.