require "spec_helper" class NavigationDummyClass end describe Nanoc::Toolbox::Helpers::Navigation do before(:each) do @navigation = NavigationDummyClass.new @navigation.extend(described_class) end describe ".render_menu" do context "when no options specified" do it "returns nil when the menu is empty" do @navigation.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 = %[
] @navigation.render_menu(sections).should == html_menu end it "returns a nested ordered list when given a multi level menu" do sections = [{:title => "Title", :link => "http://example.com", :subsections => [{:title => "Title", :link => "http://example.com" },{:title => "Title", :link => "http://example.com" }] }] html_menu = %[] @navigation.render_menu(sections).should == html_menu end it "returns only 3 levels when nothing is specified in the options" 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"} ]} ]} ]}] html_menu = %[] @navigation.render_menu(sections).should == html_menu end it "returns menu within an html ordered list (