Sha256: a19a5b40618c44ee626cc54dab89a0eb104a17779e524a4b5cc55350705ce8d1

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

class Nanoc::Helpers::BreadcrumbsTest < Nanoc::TestCase

  include Nanoc::Helpers::Breadcrumbs

  def test_breadcrumbs_trail_at_root
    @items = Nanoc::ItemArray.new
    @items << Nanoc::Item.new("root", {}, '/')
    @item = @items.last

    assert_equal [ @items[0] ], breadcrumbs_trail
  end

  def test_breadcrumbs_trail_with_1_parent
    @items = Nanoc::ItemArray.new
    @items << Nanoc::Item.new("parent", {}, '/')
    @items << Nanoc::Item.new("child",  {}, '/foo/')
    @item = @items.last

    assert_equal [ @items[0], @items[1] ], breadcrumbs_trail
  end

  def test_breadcrumbs_trail_with_many_parents
    @items = Nanoc::ItemArray.new
    @items << Nanoc::Item.new("grandparent", {}, '/')
    @items << Nanoc::Item.new("parent",      {}, '/foo/')
    @items << Nanoc::Item.new("child",       {}, '/foo/bar/')
    @item = @items.last

    assert_equal [ @items[0], @items[1], @items[2] ], breadcrumbs_trail
  end

  def test_breadcrumbs_trail_with_nils
    @items = Nanoc::ItemArray.new
    @items << Nanoc::Item.new("grandparent", {}, '/')
    @items << Nanoc::Item.new("child",       {}, '/foo/bar/')
    @item = @items.last

    assert_equal [ @items[0], nil, @items[1] ], breadcrumbs_trail
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
nanoc-3.7.3 test/helpers/test_breadcrumbs.rb
nanoc-3.7.2 test/helpers/test_breadcrumbs.rb
nanoc-3.7.1 test/helpers/test_breadcrumbs.rb
nanoc-3.7.0 test/helpers/test_breadcrumbs.rb
nanoc-3.6.11 test/helpers/test_breadcrumbs.rb
nanoc-3.6.10 test/helpers/test_breadcrumbs.rb
nanoc-3.6.9 test/helpers/test_breadcrumbs.rb
nanoc-3.6.8 test/helpers/test_breadcrumbs.rb
nanoc-3.6.7 test/helpers/test_breadcrumbs.rb
nanoc-3.6.6 test/helpers/test_breadcrumbs.rb
nanoc-3.6.5 test/helpers/test_breadcrumbs.rb
nanoc-3.6.4 test/helpers/test_breadcrumbs.rb
nanoc-3.6.3 test/helpers/test_breadcrumbs.rb
nanoc-3.6.2 test/helpers/test_breadcrumbs.rb