Sha256: 6b193f42dd810cbd8c8ee03aadf2f169849129f77cbf1a7455e6f66a6b3961a8
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
# encoding: utf-8 require 'test/helper' class Nanoc3::Helpers::BreadcrumbsTest < MiniTest::Unit::TestCase include Nanoc3::TestHelpers include Nanoc3::Helpers::Breadcrumbs def test_breadcrumbs_trail_at_root # Mock item @item = mock @item.stubs(:identifier).returns('/') @items = [ @item ] # Build trail trail = breadcrumbs_trail # Check assert_equal( [ @item ], trail ) end def test_breadcrumbs_trail_with_1_parent # Mock item parent = mock parent.stubs(:identifier).returns('/') @item = mock @item.stubs(:identifier).returns('/foo/') @items = [ parent, @item ] # Build trail trail = breadcrumbs_trail # Check assert_equal( [ parent, @item ], trail ) end def test_breadcrumbs_trail_with_many_parents # Mock item grandparent = mock grandparent.stubs(:identifier).returns('/') parent = mock parent.stubs(:identifier).returns('/foo/') @item = mock @item.stubs(:identifier).returns('/foo/bar/') @items = [ grandparent, parent, @item ] # Build trail trail = breadcrumbs_trail # Check assert_equal( [ grandparent, parent, @item ], trail ) end def test_breadcrumbs_trail_with_nils # Mock item grandparent = mock grandparent.stubs(:identifier).returns('/') @item = mock @item.stubs(:identifier).returns('/foo/bar/') @items = [ grandparent, @item ] # Build trail trail = breadcrumbs_trail # Check assert_equal( [ grandparent, nil, @item ], trail ) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanoc3-3.1.9 | test/helpers/test_breadcrumbs.rb |
nanoc3-3.1.8 | test/helpers/test_breadcrumbs.rb |
nanoc3-3.2.0a4 | test/helpers/test_breadcrumbs.rb |