fixes #2 show nothing when num_page == 1

This commit is contained in:
Akira Matsuda 2011-02-09 01:40:09 +09:00
parent e6481a1c89
commit 23186e5c9c
2 changed files with 90 additions and 82 deletions

View File

@ -67,6 +67,7 @@ module Kaminari
def tagify_links
num_pages, current_page, left, window, right = @options[:num_pages], @options[:current_page], @left, @window, @right
return [] if num_pages <= 1
tags = []
tags << (current_page > 1 ? PrevLink.new(self) : PrevSpan.new(self))

View File

@ -15,6 +15,12 @@ describe 'Kaminari::Helpers::PaginationRenderer' do
PaginationRenderer.new(renderer, options).tagify_links
end
context '1 page in total' do
subject { tags_with :num_pages => 1, :current_page => 1 }
it { should have(0).tags }
end
context '10 pages in total' do
context 'first page' do
subject { tags_with :num_pages => 10, :current_page => 1 }
it { should_not contain_tag PrevLink }
@ -106,4 +112,5 @@ describe 'Kaminari::Helpers::PaginationRenderer' do
it { should contain_tag TruncatedSpan }
end
end
end
end