From 30fb7b8c8bfc72ed3097352539544c07cbb38d0d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 16 Sep 2007 03:32:47 +0000 Subject: connection.select_rows 'sql' returns an array (rows) of arrays (field values). Closes #2329. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7497 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/finder_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index ef995aeb3f..b5bc5ae7f3 100644 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -559,6 +559,16 @@ class FinderTest < Test::Unit::TestCase assert_equal ["37signals","Summit","Microsoft", "Flamboyant Software", "Ex Nihilo", "RailsCore", "Leetsoft", "Jadedpixel", "Odegy"], Company.connection.select_values("SELECT name FROM companies ORDER BY id") end + def test_select_rows + assert_equal( + [["1", nil, nil, "37signals"], + ["2", "1", "2", "Summit"], + ["3", "1", "1", "Microsoft"]], + Company.connection.select_rows("SELECT id, firm_id, client_of, name FROM companies ORDER BY id LIMIT 3")) + assert_equal [["1", "37signals"], ["2", "Summit"], ["3", "Microsoft"]], + Company.connection.select_rows("SELECT id, name FROM companies ORDER BY id LIMIT 3") + end + protected def bind(statement, *vars) if vars.first.is_a?(Hash) -- cgit v1.2.3