Sha256: 6901bd35897e2fa9f787076ce9043b87f5c5f051fe5713c29a232d769c29d932

Contents?: true

Size: 1.51 KB

Versions: 19

Compression:

Stored size: 1.51 KB

Contents

require File.join(File.dirname(__FILE__), '/../../test_helper')

class Cms::PageHelperTest < ActionView::TestCase
  
  def test_render_breadcrumbs
    @foo = Factory(:section, :name => "Foo", :parent => root_section, :path => "/foo")
    Factory(:page, :name => "Overview", :section => @foo, :path => "/foo")
    @bar = Factory(:section, :name => "Bar", :parent => @foo, :path => "/bar")
    @overview = Factory(:page, :name => "Overview", :section => @bar, :path => "/bar")
    @bang = Factory(:page, :name => "Bang", :section => @bar, :path => "/bar/bang")

    @page = @bang
    
    expected = <<HTML
<ul class="breadcrumbs">
  <li class="first"><a href="/">My Site</a></li>
  <li><a href="/foo">Foo</a></li>
  <li><a href="/bar">Bar</a></li>
  <li>Bang</li>
</ul>
HTML
    
    assert_equal expected.chomp, render_breadcrumbs
    
    expected = <<HTML
<ul class="breadcrumbs">
  <li class="first"><a href="/foo">Foo</a></li>
  <li><a href="/bar">Bar</a></li>
  <li>Bang</li>
</ul>
HTML

    assert_equal expected.chomp, render_breadcrumbs(:from_top => 1)

    @page = @overview

    expected = <<HTML
<ul class="breadcrumbs">
  <li class="first"><a href="/foo">Foo</a></li>
  <li>Bar</li>
</ul>
HTML
    
    assert_equal expected.chomp, render_breadcrumbs(:from_top => 1)

    expected = <<HTML
<ul class="breadcrumbs">
  <li class="first"><a href="/foo">Foo</a></li>
  <li><a href="/bar">Bar</a></li>
  <li>Overview</li>
</ul>
HTML
    
    assert_equal expected.chomp, render_breadcrumbs(:from_top => 1, :show_parent => true)
  end  
  
end

Version data entries

19 entries across 19 versions & 7 rubygems

Version Path
SFEley-browsercms-3.0.2 test/unit/helpers/page_helper_test.rb
buzzware-browsercms-3.0.2 test/unit/helpers/page_helper_test.rb
coredumplings-browsercms-3.0.0 test/unit/helpers/page_helper_test.rb
nate-browsercms-3.0.210 test/unit/helpers/page_helper_test.rb
nate-browsercms-3.0.211 test/unit/helpers/page_helper_test.rb
we5-browsercms-3.0.1.1 test/unit/helpers/page_helper_test.rb
browsercms-3.0.6 test/unit/helpers/page_helper_test.rb
browsercms-3.0.5 test/unit/helpers/page_helper_test.rb
we5-browsercms-3.0.5.1 test/unit/helpers/page_helper_test.rb
we5-browsercms-3.0.5 test/unit/helpers/page_helper_test.rb
browsercms_s3-3.0.5 test/unit/helpers/page_helper_test.rb
browsercms-3.0.4 test/unit/helpers/page_helper_test.rb
browsercms-3.0.3 test/unit/helpers/page_helper_test.rb
browsercms_s3-3.0.4 test/unit/helpers/page_helper_test.rb
browsercms_s3-3.0.3 test/unit/helpers/page_helper_test.rb
we5-browsercms-3.0.2 test/unit/helpers/page_helper_test.rb
browsercms-3.0.2 test/unit/helpers/page_helper_test.rb
browsercms-3.0.1 test/unit/helpers/page_helper_test.rb
browsercms-3.0.0 test/unit/helpers/page_helper_test.rb