diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-03 22:06:33 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-03 22:06:33 +0000 |
commit | 58ebf302b206ed30568da60d7f3b124b26e9325b (patch) | |
tree | 16c37488980a7597b68bdf5056089197c31cf2f3 /activerecord/test | |
parent | 149d1815625e2df4709415c1129fbdd413f9ca44 (diff) | |
download | rails-58ebf302b206ed30568da60d7f3b124b26e9325b.tar.gz rails-58ebf302b206ed30568da60d7f3b124b26e9325b.tar.bz2 rails-58ebf302b206ed30568da60d7f3b124b26e9325b.zip |
The exists? class method should treat a string argument as an id rather than as conditions. Closes #5698.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4655 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/finder_test.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index 7e950dac41..626fe137c9 100644 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -20,13 +20,14 @@ class FinderTest < Test::Unit::TestCase end def test_exists - assert (Topic.exists?(1)) - assert (Topic.exists?(:author_name => "David")) - assert (Topic.exists?(:author_name => "Mary", :approved => true)) - assert (Topic.exists?(["parent_id = ?", 1])) - assert !(Topic.exists?(45)) - assert !(Topic.exists?("foo")) - assert !(Topic.exists?([1,2])) + assert Topic.exists?(1) + assert Topic.exists?("1") + assert Topic.exists?(:author_name => "David") + assert Topic.exists?(:author_name => "Mary", :approved => true) + assert Topic.exists?(["parent_id = ?", 1]) + assert !Topic.exists?(45) + assert !Topic.exists?("foo") + assert_raise(NoMethodError) { Topic.exists?([1,2]) } end def test_find_by_array_of_one_id |