Trying to make sure my revised oracle_adapter passes all tests, and I'm running into an issue with test/calculations.rb.

Calculations itself seems to work fine. The problem is that the the tests presume that the values returned by things like "group by firm_id" are always strings.

In Oracle, the adapter is able to detect the datatype, and returns back the "right" type, rather than just strings. I'm assuming that mysql just treats these as strings?

As an example, if I change:

  def test_should_calculate_grouped_with_invalid_field
    c = Account.count(:all, :group => 'accounts.firm_id')
    assert_equal 1, c['1']
    assert_equal 2, c['6']
    assert_equal 1, c['2']
  end


to:

  def test_should_calculate_grouped_with_invalid_field
    c = Account.count(:all, :group => 'accounts.firm_id')
    assert_equal 1, c[1]
    assert_equal 2, c[6]
    assert_equal 1, c[2]
  end

then it works just fine for me.

If somebody (Rick?) can confirm I understand the issue properly, I'll make the unit tests pass for Oracle by hacking the tests if the current adapter is Oracle.

_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to