Froze rails gems
[depot.git] / vendor / rails / actionpack / test / controller / html-scanner / text_node_test.rb
1 require 'abstract_unit'
2
3 class TextNodeTest < Test::Unit::TestCase
4 def setup
5 @node = HTML::Text.new(nil, 0, 0, "hello, howdy, aloha, annyeong")
6 end
7
8 def test_to_s
9 assert_equal "hello, howdy, aloha, annyeong", @node.to_s
10 end
11
12 def test_find_string
13 assert_equal @node, @node.find("hello, howdy, aloha, annyeong")
14 assert_equal false, @node.find("bogus")
15 end
16
17 def test_find_regexp
18 assert_equal @node, @node.find(/an+y/)
19 assert_nil @node.find(/b/)
20 end
21
22 def test_find_hash
23 assert_equal @node, @node.find(:content => /howdy/)
24 assert_nil @node.find(:content => /^howdy$/)
25 assert_equal false, @node.find(:content => "howdy")
26 end
27
28 def test_find_other
29 assert_nil @node.find(:hello)
30 end
31
32 def test_match_string
33 assert @node.match("hello, howdy, aloha, annyeong")
34 assert_equal false, @node.match("bogus")
35 end
36
37 def test_match_regexp
38 assert_not_nil @node, @node.match(/an+y/)
39 assert_nil @node.match(/b/)
40 end
41
42 def test_match_hash
43 assert_not_nil @node, @node.match(:content => "howdy")
44 assert_nil @node.match(:content => /^howdy$/)
45 end
46
47 def test_match_other
48 assert_nil @node.match(:hello)
49 end
50 end