aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
diff options
context:
space:
mode:
authorScott Taylor <scott@railsnewbie.com>2009-01-31 21:32:49 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-02-05 20:51:06 +0100
commit5a8f764661bcdf9c6ce503c0ff343a1970deb1bb (patch)
treed834baa2819042a33226ca2931b54b0e4308415f /activerecord/test/cases/finder_test.rb
parent6db78e8c02442080d2be93faeeb42be97b09fb53 (diff)
downloadrails-5a8f764661bcdf9c6ce503c0ff343a1970deb1bb.tar.gz
rails-5a8f764661bcdf9c6ce503c0ff343a1970deb1bb.tar.bz2
rails-5a8f764661bcdf9c6ce503c0ff343a1970deb1bb.zip
Add ActiveRecord::Base.exists? with no args [#1817 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r--activerecord/test/cases/finder_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 7fd7fd7a5b..aac5e6a96b 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -94,7 +94,16 @@ class FinderTest < ActiveRecord::TestCase
assert_raise(NoMethodError) { Topic.exists?([1,2]) }
end
-
+
+ def test_exists_returns_true_with_one_record_and_no_args
+ assert Topic.exists?
+ end
+
+ def test_does_not_exist_with_empty_table_and_no_args_given
+ Topic.delete_all
+ assert !Topic.exists?
+ end
+
def test_exists_with_aggregate_having_three_mappings
existing_address = customers(:david).address
assert Customer.exists?(:address => existing_address)