2005-01-20 09:55:13 -05:00
|
|
|
require 'abstract_unit'
|
|
|
|
require 'fixtures/topic'
|
|
|
|
|
|
|
|
class TestColumnAlias < Test::Unit::TestCase
|
2005-10-23 15:02:38 -04:00
|
|
|
fixtures :topics
|
|
|
|
|
2006-03-01 11:01:53 -05:00
|
|
|
QUERY = if 'Oracle' == ActiveRecord::Base.connection.adapter_name
|
2005-10-23 15:02:38 -04:00
|
|
|
'SELECT id AS pk FROM topics WHERE ROWNUM < 2'
|
|
|
|
else
|
|
|
|
'SELECT id AS pk FROM topics'
|
|
|
|
end
|
2005-01-20 09:55:13 -05:00
|
|
|
|
|
|
|
def test_column_alias
|
2005-10-23 15:02:38 -04:00
|
|
|
records = Topic.connection.select_all(QUERY)
|
|
|
|
assert_equal 'pk', records[0].keys[0]
|
2005-01-20 09:55:13 -05:00
|
|
|
end
|
|
|
|
end
|