diff --git a/test/finder_test.rb b/test/finder_test.rb index 38ef565..af62d7f 100644 --- a/test/finder_test.rb +++ b/test/finder_test.rb @@ -251,6 +251,17 @@ class FinderTest < ActiveRecordTestCase end end + def test_paginate_in_named_scope_on_hmt_uniq_association + project = projects(:active_record) + expected = [replies(:brave)] + + assert_queries(2) do + entries = project.uniq_replies.paginate :page => 1, :per_page => 1 + assert_equal expected, entries + assert_equal 1, entries.total_entries, 'only one reply should be found' + end + end + def test_paginate_in_named_scope_on_has_many_association project = projects(:active_record) expected = [topics(:ar)] diff --git a/test/fixtures/project.rb b/test/fixtures/project.rb index 0f85ef5..a0e50c9 100644 --- a/test/fixtures/project.rb +++ b/test/fixtures/project.rb @@ -12,4 +12,6 @@ class Project < ActiveRecord::Base end end end + + has_many :uniq_replies, :source => :replies, :through => :topics, :uniq => true end