From 686b1b46c0b80b777e5b40cebd8a166b6d2f6d83 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Thu, 5 May 2011 23:28:41 +0900 Subject: [PATCH] use helper instead of polluting Object --- spec/helpers/action_view_extension_spec.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/spec/helpers/action_view_extension_spec.rb b/spec/helpers/action_view_extension_spec.rb index da1646e..28d46af 100644 --- a/spec/helpers/action_view_extension_spec.rb +++ b/spec/helpers/action_view_extension_spec.rb @@ -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