Permalink
Browse files

Now matching <br /> to \n

  • Loading branch information...
1 parent 5d38048 commit cf0237b9a4bf04398592c1211ca1bd39c55fea7c bendycode committed May 13, 2009
Showing with 8 additions and 2 deletions.
  1. +1 −1 lib/matchers/table_header_matcher.rb
  2. +7 −1 spec/table_header_matcher_spec.rb
@@ -27,7 +27,7 @@ def negative_failure_message
end
def extract_html_content html
- html = html.gsub('<br/>', "\n")
+ html = html.gsub(/<br *\/>/, "\n")
doc = Hpricot.XML(html)
elements = doc.search("table#{"##{@table_id}" if @table_id} tr")
elements = elements.reject{|e| e.search('th').empty? }
@@ -24,11 +24,17 @@
[['h1', 'h2'], ['h3', 'h4']]
end
- it 'should replace <br/> to \n' do
+ it 'should match "<br/>" to "\n"' do
verify_table_header_match 'my_id',
'<table id="my_id"><tr><th>h1 - row 1<br/>h1 - row 2</th></tr></table>',
[["h1 - row 1\nh1 - row 2"]]
end
+
+ it 'should match "<br />" to "\n"' do
+ verify_table_header_match 'my_id',
+ "<table id='my_id'><tr><th>h1 - row 1<br />h1 - row 2</th></tr></table>",
+ [["h1 - row 1\nh1 - row 2"]]
+ end
end
describe 'passed wrong id' do

0 comments on commit cf0237b

Please sign in to comment.