Forum: Rails-core (closed, excessive spam) Tests Broken!

Posted by Hampton (Guest)
on 2006-06-25 01:07
(Received via mailing list)
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.
Posted by Coda Hale (Guest)
on 2006-06-25 02:27
(Received via mailing list)
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).
Posted by Hampton (Guest)
on 2006-06-25 20:40
(Received via mailing list)
This patch fixes the errors I was getting.
This topic is locked and can not be replied to.