Sha256: 46962929f60c8910bfec8a8e5f60151da3ec9d49d4fb30b12de090a2566bb457

Contents?: true

Size: 1.17 KB

Versions: 93

Compression:

Stored size: 1.17 KB

Contents

require 'abstract_unit'

class TextNodeTest < Test::Unit::TestCase
  def setup
    @node = HTML::Text.new(nil, 0, 0, "hello, howdy, aloha, annyeong")
  end
  
  def test_to_s
    assert_equal "hello, howdy, aloha, annyeong", @node.to_s
  end
  
  def test_find_string
    assert_equal @node, @node.find("hello, howdy, aloha, annyeong")
    assert_equal false, @node.find("bogus")
  end
  
  def test_find_regexp
    assert_equal @node, @node.find(/an+y/)
    assert_nil @node.find(/b/)
  end
  
  def test_find_hash
    assert_equal @node, @node.find(:content => /howdy/)
    assert_nil @node.find(:content => /^howdy$/)
    assert_equal false, @node.find(:content => "howdy")
  end
  
  def test_find_other
    assert_nil @node.find(:hello)
  end

  def test_match_string
    assert @node.match("hello, howdy, aloha, annyeong")
    assert_equal false, @node.match("bogus")
  end

  def test_match_regexp
    assert_not_nil @node, @node.match(/an+y/)
    assert_nil @node.match(/b/)
  end

  def test_match_hash
    assert_not_nil @node, @node.match(:content => "howdy")
    assert_nil @node.match(:content => /^howdy$/)
  end

  def test_match_other
    assert_nil @node.match(:hello)
  end
end

Version data entries

93 entries across 90 versions & 21 rubygems

Version Path
elkinsware-erubis_rails_helper-0.6.0 test/controller/html-scanner/text_node_test.rb
elkinsware-erubis_rails_helper-0.6.1 test/controller/html-scanner/text_node_test.rb
elkinsware-erubis_rails_helper-0.9.0 test/controller/html-scanner/text_node_test.rb
elkinsware-erubis_rails_helper-0.9.1 test/controller/html-scanner/text_node_test.rb
elkinsware-erubis_rails_helper-0.9.5 test/controller/html-scanner/text_node_test.rb
ghazel-erubis_rails_helper-0.9.5 test/controller/html-scanner/text_node_test.rb
actionpack-2.3.18 test/controller/html-scanner/text_node_test.rb
actionpack_csi-2.3.5.p8 test/controller/html-scanner/text_node_test.rb
actionpack-2.3.17-rack-upgrade-2.3.17 test/controller/html-scanner/text_node_test.rb
actionpack-2.3.17 test/controller/html-scanner/text_node_test.rb
actionpack_csi-2.3.5.p7 test/controller/html-scanner/text_node_test.rb
actionpack_csi-2.3.5.p6 test/controller/html-scanner/text_node_test.rb
actionpack-2.3.16 test/controller/html-scanner/text_node_test.rb
actionpack-rack-upgrade-2-2.3.16 test/controller/html-scanner/text_node_test.rb
actionpack-rack-upgrade-2-2.3.15 test/controller/html-scanner/text_node_test.rb
actionpack-2.3.15 test/controller/html-scanner/text_node_test.rb
actionpack-rack-upgrade-2.3.16 test/controller/html-scanner/text_node_test.rb
actionpack-rack-upgrade-2.3.15 test/controller/html-scanner/text_node_test.rb
actionpack-rack-upgrade-2.3.14 test/controller/html-scanner/text_node_test.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/actionpack-2.3.14/test/controller/html-scanner/text_node_test.rb