Sha256: ca25304d32859d5c2e2e655a223f3cfff1f8078e81d6ead081e896cace6db004

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path('../spec_helper', File.dirname(__FILE__))

describe 'Kaminari::ActionViewExtension' do
  before do
    50.times {|i| User.create! :name => "user#{i}"}
  end
  describe '#paginate' do
    before do
      @users = User.page(1)
    end
    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(helper.paginate @users, :params => {:controller => 'users', :action => 'index'}) }.should_not raise_error
      end
    end
  end

  describe '#link_to_next_page' do
    context 'having more page' do
      before do
        @users = User.page(1)
      end
      subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
      it { should be_a String }
    end
    context 'the last page' do
      before do
        @users = User.page(2)
      end
      subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
      it { should_not be }
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
wulffeld_kaminari-0.12.4.2 spec/helpers/action_view_extension_spec.rb
wulffeld_kaminari-0.12.4.1 spec/helpers/action_view_extension_spec.rb
sayso-kaminari-0.12.4.001 spec/helpers/action_view_extension_spec.rb
dimkiriyenko-kaminari-0.12.6 spec/helpers/action_view_extension_spec.rb
dimkiriyenko-kaminari-0.12.5 spec/helpers/action_view_extension_spec.rb
dimkiriyenko-kaminari-0.12.4 spec/helpers/action_view_extension_spec.rb