Sha256: cc24e24967e232e257f05b4f49f94f177a6919b54358330059fef7fa4bda3e0a

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

class MenuHelperTest < ActionView::TestCase
  tests MenuHelper
  
  def test_should_build_menu_bar
    menu_bar_html = menu_bar({}, :class => 'pretty') do |main|
      main.menu :home do |home|
        home.menu :browse
        home.menu :search
      end
      main.menu :contact, 'Contact Us'
      main.menu :about_us
    end
    
    expected = <<-eos
<ul class="pretty menubar menubar-1">
  <li><a href="http://test.host/home"><span>Home</span></a>
    <ul class="menubar menubar-2">
      <li><a href="http://test.host/home/browse"><span>Browse</span></a></li>
      <li class="menubar-last"><a href="http://test.host/home/search"><span>Search</span></a></li>
    </ul>
  </li>
  <li class="menubar-selected"><a href="http://test.host/contact"><span>Contact Us</span></a></li>
  <li class="menubar-last"><a href="http://test.host/about_us"><span>About Us</span></a></li>
</ul>
eos
    assert_equal expected.gsub(/\n\s*/, ''), menu_bar_html
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
menu_helper-0.2.0 test/helpers/menu_helper_test.rb