Permalink
Browse files

fix issue#265

  • Loading branch information...
1 parent 82a38e0 commit cb1dbb4f19624ad55c22f63ae6a6c8c7715420d3 @eitoball eitoball committed Jul 29, 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 cb1dbb4

Please sign in to comment.