diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-15 15:30:05 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-15 15:30:58 -0800 |
commit | 7bf9cbb7667d3725535c1410df95892891665a95 (patch) | |
tree | 682ca1d19815173aa87bdc9a137396807c4a8892 /activerecord/test | |
parent | bd96e45641df33d91ebc7b1dbb1589b376c6ef24 (diff) | |
download | rails-7bf9cbb7667d3725535c1410df95892891665a95.tar.gz rails-7bf9cbb7667d3725535c1410df95892891665a95.tar.bz2 rails-7bf9cbb7667d3725535c1410df95892891665a95.zip |
adding more test coverage around finding with active record objects
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 13c26a0c15..24539df6ff 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -432,6 +432,18 @@ class RelationTest < ActiveRecord::TestCase assert_equal 1, authors.all.length end + def test_find_with_list_of_ar + author = Author.first + authors = Author.find([author]) + assert_equal author, authors.first + end + + def test_find_by_id_with_list_of_ar + author = Author.first + authors = Author.find_by_id([author]) + assert_equal author, authors + end + def test_exists davids = Author.where(:name => 'David') assert davids.exists? |