diff options
author | miloops <miloops@gmail.com> | 2008-09-11 17:41:55 -0300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-11 22:51:57 +0200 |
commit | a37c5ae961366e3d693991b51d0830d40ae37e08 (patch) | |
tree | 0fa9d5de486f5d2fc317676df182d34040a8da1a /activerecord/test/cases/finder_test.rb | |
parent | 095ad690f3fb6df4e89446dd40e03cf2c204e42a (diff) | |
download | rails-a37c5ae961366e3d693991b51d0830d40ae37e08.tar.gz rails-a37c5ae961366e3d693991b51d0830d40ae37e08.tar.bz2 rails-a37c5ae961366e3d693991b51d0830d40ae37e08.zip |
Improve test coverage when using the group option in find, has_many or has_and_belongs_to_many.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
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 aede8a6393..ddfebaec08 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -169,6 +169,12 @@ class FinderTest < ActiveRecord::TestCase assert_equal("fixture_3", developers.first.name) end + def test_find_with_group + developers = Developer.find(:all, :group => "salary") + assert_equal 4, developers.size + assert_equal 4, developers.uniq(&:salary).size + end + def test_find_with_entire_select_statement topics = Topic.find_by_sql "SELECT * FROM topics WHERE author_name = 'Mary'" |