mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
use helper instead of polluting Object
This commit is contained in:
parent
2d030d64c9
commit
686b1b46c0
1 changed files with 7 additions and 9 deletions
|
@ -1,19 +1,17 @@
|
|||
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
||||
include Kaminari::ActionViewExtension
|
||||
|
||||
describe 'Kaminari::ActionViewExtension' do
|
||||
describe '#paginate' do
|
||||
before do
|
||||
@author = User.create! :name => 'author'
|
||||
@books = 2.times.map { @author.books_authored.create! }
|
||||
@books = Book.page(1)
|
||||
50.times {|i| User.create! :name => "user#{i}"}
|
||||
@users = User.page(1)
|
||||
end
|
||||
subject { paginate( @books ) }
|
||||
it { should be_a(String) }
|
||||
subject { helper.paginate @users, :params => {:controller => 'users', :action => 'index'} }
|
||||
it { should be_a String }
|
||||
|
||||
context "escaping the pagination for javascript" do
|
||||
it "should escape for javascript" do
|
||||
lambda { escape_javascript( paginate( @books ) ) }.should_not raise_error
|
||||
context 'escaping the pagination for javascript' do
|
||||
it 'should escape for javascript' do
|
||||
lambda { escape_javascript(helper.paginate @users, :params => {:controller => 'users', :action => 'index'}) }.should_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue