Skip to content

Commit

Permalink
Add WillPaginate test and confirm grouped scope, named scope, and wil…
Browse files Browse the repository at this point in the history
…l paginate all play together.
  • Loading branch information
metaskills committed Sep 29, 2008
1 parent 693b17e commit 443eee3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*0.2* (September 29th 2008)

* Add WillPaginate test and confirm grouped scope, named scope, and will paginate all play together. [Ken Collins]

* Stronger back port for named_scope in 1.2.6 and 2.0.4. Fixed bug where association proxy owner scope was after named_scope calls. [Ken Collins]


*0.1* (September 26th, 2008)

* Initial public release. [Ken Collins]


2 changes: 1 addition & 1 deletion lib/grouped_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

module GroupedScope

VERSION = '0.1'
VERSION = '0.2'

end

11 changes: 11 additions & 0 deletions test/grouped_scope/has_many_association_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ def setup
end
end

context 'with will paginate' do

should 'use group reflection, named scope, and paginate SQL' do
where_ends_with_limits = /WHERE.*LIMIT 2 OFFSET 0/
assert_sql(select_from_reports, where_for_groups, where_for_urgent_body, where_for_urgent_title, where_ends_with_limits) do
@e2.group.reports.with_urgent_title.with_urgent_body.paginate(:page=>1,:per_page=>2)
end
end

end

end

end
Expand Down
5 changes: 5 additions & 0 deletions test/lib/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@
require 'active_record'
require 'active_support'

gem 'mislav-will_paginate', '2.3.4'
require 'will_paginate'
WillPaginate.enable_activerecord

unless defined? ActiveRecord::NamedScope
require 'core_ext'
require 'named_scope'
require ActiveRecord::Base.respond_to?(:find_first) ? 'named_scope_patch_1.2.6' : 'named_scope_patch_2.0'
ActiveRecord::Base.send :include, GroupedScope::NamedScope
end

0 comments on commit 443eee3

Please sign in to comment.