diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-24 19:59:22 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-24 19:59:22 +0000 |
commit | c6f2af5c31577e25c6f6b9f17be18858200a8e13 (patch) | |
tree | 4b5835b922381231aca10b5b1235d4a555a3af83 /activerecord/test/cases/finder_test.rb | |
parent | 081ddb6f24d70794ee9e071d3ed5302f52b26c4d (diff) | |
download | rails-c6f2af5c31577e25c6f6b9f17be18858200a8e13.tar.gz rails-c6f2af5c31577e25c6f6b9f17be18858200a8e13.tar.bz2 rails-c6f2af5c31577e25c6f6b9f17be18858200a8e13.zip |
Added ActiveRecord#Base.all/first/last as aliases for find(:all/:first/:last) (closes #11413) [nkallen, thechrisoshow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9085 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 5da8603070..8cb5c9206a 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -143,6 +143,14 @@ class FinderTest < ActiveRecord::TestCase first = Topic.find(:first, :conditions => "title = 'The First Topic!'") assert_nil(first) end + + def test_first + assert_equal topics(:second).title, Topic.first(:conditions => "title = 'The Second Topic of the day'").title + end + + def test_first_failing + assert_nil Topic.first(:conditions => "title = 'The Second Topic of the day!'") + end def test_unexisting_record_exception_handling assert_raises(ActiveRecord::RecordNotFound) { |