mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
parent
f63112eb40
commit
defc7ba92e
2 changed files with 15 additions and 0 deletions
|
@ -106,6 +106,12 @@ module Kaminari
|
|||
end
|
||||
end
|
||||
|
||||
# delegates view helper methods to @template
|
||||
def method_missing(name, *args, &block)
|
||||
@template.respond_to?(name) ? @template.send(name, *args, &block) : super
|
||||
end
|
||||
private :method_missing
|
||||
|
||||
# Wraps a "page number" and provides some utility methods
|
||||
class PageProxy
|
||||
include Comparable
|
||||
|
|
|
@ -8,10 +8,19 @@ describe 'Kaminari::Helpers::Paginator' do
|
|||
params { {} }
|
||||
options { {} }
|
||||
url_for {|h| "/foo?page=#{h[:page]}"}
|
||||
link_to { "<a href='#'>link</a>" }
|
||||
end
|
||||
r
|
||||
end
|
||||
|
||||
describe "view helper methods delegated to template" do
|
||||
before do
|
||||
@paginator = Paginator.new(template, :params => {})
|
||||
end
|
||||
subject { @paginator.link_to("link", "#") }
|
||||
it { should == "<a href='#'>link</a>" }
|
||||
end
|
||||
|
||||
describe '#params' do
|
||||
before do
|
||||
@paginator = Paginator.new(template, :params => {:controller => 'foo', :action => 'bar'})
|
||||
|
|
Loading…
Add table
Reference in a new issue