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 %(
), html end test '.buoy (not only active)' do buoy :history html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') expected_html = %( ).gsub(/[[:space:]]{2,}|\n/, '') assert_dom_equal expected_html, html end test '.buoy (has 2 `link`s in one buoy block)' do breadcrumb :help, true html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') expected_html = %( ).gsub(/[[:space:]]{2,}|\n/, '') assert_dom_equal expected_html, html end test '.buoy (receive multiple arguments)' do breadcrumb :edit_book_author, 1, 2 html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') expected_html = %( ).gsub(/[[:space:]]{2,}|\n/, '') assert_dom_equal expected_html, html end test ".buoy (has configuration options in link's arguments)" do breadcrumb :show_books, 1 html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') expected_html = %( ).gsub(/[[:space:]]{2,}|\n/, '') assert_dom_equal expected_html, html end test '.buoys (no given key)' do buoys html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '') assert_dom_equal '', html end end