Sha256: 19e0372e8cd6dc303629cb2aeb8eab93e5444d586509a5f87cce95b3e6388302

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 Bytes

Contents

require 'spec_helper'

describe Gollum::DescendantTree::TreeBuilder do

  it "returns the correct tree" do
    wiki = double
    wiki.stub(:pages).and_return(pages)
    tree_builder = Gollum::DescendantTree::TreeBuilder.new(wiki, 'current_page.md')
    expect(tree_builder.tree).to eq(tree_with_correct_nesting)
  end

  def pages
    build_mock_pages
  end

  def tree_with_correct_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_builder_spec.rb