require "spec_helper" class NavigationDummyClass include Nanoc::Toolbox::Helpers::Navigation end describe Nanoc::Toolbox::Helpers::Navigation do subject { NavigationDummyClass.new } it { should respond_to(:render_menu) } it { should respond_to(:navigation_for) } it { should respond_to(:toc_for) } it { should respond_to(:breadcrumb_for) } describe ".render_menu" do before do @sections = [ {:title => "Title", :link => "http://example.com", :subsections => [ {:title => "Title", :link => "http://example.com", :subsections => [ {:title => "Title", :link => "http://example.com", :subsections => [ {:title => "Title", :link => "http://example.com"} ]} ]} ]}] end context "when no options specified" do it "returns nil when the menu is empty" do subject.render_menu([]).should be_nil end it "returns a simple ordered list when given a 1 level menu" do sections = [{:title => "Title", :link => "http://example.com" }] html_menu = %[] subject.render_menu(sections).should == html_menu end it "returns a nested ordered list when given a multi level menu" do html_menu = %[] subject.render_menu(@sections).should == html_menu end it "returns only 3 levels deep" do html_menu = %[] subject.render_menu(@sections).should == html_menu end it "returns menu within an html ordered list with menu class(
  1. )" do subject.render_menu(@sections).should =~ /^