Sha256: e0c3fb3f1434d187b715387c573367e309badd4dfabbc599fba383548fb37522
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' describe Gollum::DescendantTree::TreeRenderer do it "correctly renders a tree with indexes" do wiki = double wiki.stub(:pages).and_return(pages) tree_renderer = Gollum::DescendantTree::TreeRenderer.new expect(tree_renderer.render(tree_with_nesting)).to eq(correct_output) end def pages build_mock_pages end def correct_output "<ul class='tree'>\n<li><a href='/current_page'>Current Page</a><ul>\n<li><a href='/current_page/child'>Child</a><ul>\n<li><a href='/current_page/child/grandchild'>Grandchild</a><ul>\n<li><a href='/current_page/child/grandchild/greatgrandchild'>GreatGrandchild</a></li></ul>\n</li></ul>\n<li><a href='/current_page/child_sibling'>Child Sibling</a></ul></li>\n</ul>\n" end def tree_with_nesting [{:title=>"Current Page", :url_path=>"current_page", :nest_index=>0}, {:title=>"Child", :url_path=>"current_page/child", :nest_index=>1}, {:title=>"Grandchild", :url_path=>"current_page/child/grandchild", :nest_index=>2}, {:title=>"GreatGrandchild",:url_path=>"current_page/child/grandchild/greatgrandchild", :nest_index=>3}, {:title=>"Child Sibling", :url_path=>"current_page/child_sibling", :nest_index=>1}] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gollum-descendant_tree-0.0.1 | spec/gollum/descendant_tree/tree_renderer_spec.rb |