Permalink
Browse files

Add test to column alias in `exists?` SQL.

This behavior was added in dd286a4

Closes #1139.

Fixes #2553, #1141, #1623 and #2062.
  • Loading branch information...
1 parent dd286a4 commit 179276e2b6f6bd846690b4c0ab4399cf487357ba @rafaelfranca rafaelfranca committed Jun 10, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 activerecord/test/cases/finder_test.rb
@@ -45,6 +45,12 @@ def test_exists
assert_raise(NoMethodError) { Topic.exists?([1,2]) }
end
+ def test_exists_does_not_select_columns_without_alias
+ assert_sql(/SELECT\W+1 AS _one FROM ["`]topics["`]\W+LIMIT 1/) do
+ Topic.exists?
+ end
+ end
+
def test_exists_returns_true_with_one_record_and_no_args
assert Topic.exists?
end

0 comments on commit 179276e

Please sign in to comment.