Permalink
Browse files

Corrected the append order for the separator of html_list.

  • Loading branch information...
1 parent bc34c36 commit d37395b1bae2e894a340690ab5b31df887f03ffe @fotos fotos committed Apr 18, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −1 lib/crummy/standard_renderer.rb
  2. +2 −0 test/standard_renderer_test.rb
View
2 lib/crummy/standard_renderer.rb
@@ -49,7 +49,7 @@ def render_crumbs(crumbs, options = {})
options[:ul_id] ||= Crummy.configuration.ul_id
crumb_string = crumbs.collect do |crumb|
crumb_to_html_list(crumb, options[:links], options[:li_class], options[:active_li_class], options[:first_class], options[:last_class], (crumb == crumbs.first), (crumb == crumbs.last))
- end.reduce { |memo, obj| memo << obj + options[:separator] }
+ end.reduce { |memo, obj| memo << options[:separator] << obj }
crumb_string = content_tag(:ul, crumb_string, :class => options[:ul_class], :id => options[:ul_id])
crumb_string
when :xml
View
2 test/standard_renderer_test.rb
@@ -24,6 +24,8 @@ def test_classes
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :html))
assert_equal('<ul class="" id=""><li class="first"><a href="url1">name1</a></li><li class="li_class"><a href="url2">name2</a></li><li class="last"><a href="url3">name3</a></li></ul>',
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list))
+ assert_equal('<ul class="" id=""><li class="first"><a href="url1">name1</a></li> / <li class="li_class"><a href="url2">name2</a></li> / <li class="last"><a href="url3">name3</a></li></ul>',
+ renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :separator => " / "))
assert_equal('<crumb href="url1">name1</crumb><crumb href="url2">name2</crumb>',
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :xml))
end

0 comments on commit d37395b

Please sign in to comment.