Sha256: da5cb383bff89e757648844fce0ff61f36b934560337995a62e5f9e1aa270ec1

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

require 'test_helper'

class BuoysHelerTest < ActionView::TestCase
  include Buoys::Helper

  test '.buoy (only current)' do
    assert respond_to?(:breadcrumb)

    buoy :account
    html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '')

    assert_dom_equal %{<ul><li><a class="active" href=""><span>Account</span></a></li></ul>}, html
  end

  test '.buoy (not only active)' do
    buoy :history
    html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '')

    assert_dom_equal %{<ul><li><a class="hover" href="/about"><span>about</span></a><span>&gt;</span></li><li><a class="active" href=""><span>history</span></a></li></ul>}, html
  end

  test '.buoy (has 2 `link`s in one buoy block)' do
    breadcrumb :help, true
    html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '')

    assert_dom_equal %{<ul><li><a class="hover" href="https://example.com/help"><span>help</span></a><span>&gt;</span></li><li><a class="active" href=""><span>usage</span></a></li></ul>}, html
  end

  test ".buoy (has configuration options in link's arguments)" do
    breadcrumb :show_books, 1
    html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '')

    assert_dom_equal %{<ul><li><a class="hover" href="http://example.com/books"><span>Books</span></a><span>&gt;</span></li><li><a class="active" href="http://example.com/books/1"><span>show-1</span></a></li></ul>}, html
  end

  test '.buoys (no given key)' do
    buoys
    html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '')

    assert_dom_equal '', html
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buoys-0.1.0 test/buoys_helper_test.rb