require File.expand_path(File.dirname(__FILE__) + '/../test_helper') class HtmlElementByDefaultTest < Test::Unit::TestCase def setup @element = TableHelper::HtmlElement.new end def test_should_generate_an_empty_tag assert_equal '<>>', @element.html end def test_not_have_any_html_options element = TableHelper::HtmlElement.new assert_nil element[:class] end end class HtmlElementTest < Test::Unit::TestCase class DivElement < TableHelper::HtmlElement def tag_name 'div' end end def test_should_set_html_options_on_initialization element = TableHelper::HtmlElement.new(:class => 'fancy') assert_equal 'fancy', element[:class] end def test_should_symbolize_html_options element = TableHelper::HtmlElement.new('class' => 'fancy') assert_equal 'fancy', element[:class] end def test_should_generate_entire_element_if_content_and_tag_name_specified element = DivElement.new element.instance_eval do def content 'hello world' end end assert_equal '