Sha256: ed7c1ec61c80a03d9b60d5d263014173f16d4367096eda63fdfa6c6c8809564d

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 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

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 test/helpers/test_breadcrumbs.rb
nanoc-3.7.5 test/helpers/test_breadcrumbs.rb