diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1405f6af..75360767 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -26,7 +26,7 @@ module ApplicationHelper badge_class = "badge" badge_class << " badge-#{options[:badge_color]}" unless options[:badge_color].nil? badge_class << " badge-pill" if options[:badge_pill] - body << " #{content_tag(:span, options[:badge], class: badge_class)}" + body += " #{content_tag(:span, options[:badge], class: badge_class)}" end content_tag(:li, link_to(body.html_safe, path, class: "nav-link"), class: classes) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 6bdc4702..fa6f8b4e 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -3,6 +3,40 @@ require "rails_helper" describe ApplicationHelper, :type => :helper do + describe '#nav_entry' do + it 'should return a HTML navigation item which links to a given address' do + allow(self).to receive(:current_page?).and_return(false) + expect(nav_entry('Example', '/example')).to( + eq('