Permalink
Browse files

Merge pull request #266 from eitoball/issue_265

Fix issue#265
  • Loading branch information...
2 parents 82a38e0 + cb1dbb4 commit 2dc78d04ad16bcf9b274c3765ce18fffc3498bb3 @hsbt hsbt committed Sep 1, 2012
Showing with 8 additions and 5 deletions.
  1. +3 −5 lib/kaminari/helpers/action_view_extension.rb
  2. +5 −0 spec/helpers/action_view_extension_spec.rb
@@ -86,12 +86,10 @@ def link_to_next_page(scope, name, options = {}, &block)
# <%= page_entries_info @posts, :entry_name => 'item' %>
# #-> Displaying items 6 - 10 of 26 in total
def page_entries_info(collection, options = {})
- entry_name = options[:entry_name] || (collection.empty? ? 'entry' : collection.first.class.name.underscore.sub('_', ' '))
-
- entry_name = if collection.empty?
- 'entry'
- elsif options[:entry_name]
+ entry_name = if options[:entry_name]
options[:entry_name]
+ elsif collection.empty?
+ 'entry'
else
if collection.respond_to? :model # DataMapper
collection.model.model_name.human.downcase
@@ -78,6 +78,11 @@
context 'having no entries' do
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'No entries found' }
+
+ context 'setting the entry name option to "member"' do
+ subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
+ it { should == 'No members found' }
+ end
end
context 'having 1 entry' do

0 comments on commit 2dc78d0

Please sign in to comment.