diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-10 17:04:15 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-10 17:05:01 -0300 |
commit | 179276e2b6f6bd846690b4c0ab4399cf487357ba (patch) | |
tree | 9e6871bdbe1278a751096a48f4473e5b57073e29 /activerecord/test/cases/finder_test.rb | |
parent | dd286a4c735dac1db8c9262581c7f29c44d1f695 (diff) | |
download | rails-179276e2b6f6bd846690b4c0ab4399cf487357ba.tar.gz rails-179276e2b6f6bd846690b4c0ab4399cf487357ba.tar.bz2 rails-179276e2b6f6bd846690b4c0ab4399cf487357ba.zip |
Add test to column alias in `exists?` SQL.
This behavior was added in dd286a4c735dac1db8c9262581c7f29c44d1f695
Closes #1139.
Fixes #2553, #1141, #1623 and #2062.
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 9bf9fe7d82..8622a1a295 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -45,6 +45,12 @@ class FinderTest < ActiveRecord::TestCase 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 |