Permalink
Browse files

Changed to selector, instead of id.

  • Loading branch information...
1 parent 5c84e9d commit 14fdea1323ee1e7fd02269f1f173c848a8967ff6 bendycode committed Jul 12, 2009
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/matchers/table_matcher.rb
@@ -3,13 +3,13 @@ module Rails
module Matchers
class TableMatcher
- def initialize table_id_or_expected, expected
- case table_id_or_expected
+ def initialize table_selector_or_expected, expected
+ case table_selector_or_expected
when String
- @table_id = table_id_or_expected
+ @table_selector = table_selector_or_expected
@expected = expected
when Array
- @expected = table_id_or_expected
+ @expected = table_selector_or_expected
end
raise 'Invalid "expected" argument' if @expected.nil?
end
@@ -30,7 +30,7 @@ def negative_failure_message
def extract_html_content html
doc = Hpricot.XML(html)
- rows = doc.search("table#{"##{@table_id}" if @table_id} tr")
+ rows = doc.search("table#{"#{@table_selector}" if @table_selector} tr")
header_elements = rows.reject{|e| e.search('th').empty? }
header_content = header_elements.map{|n| n.search('/th').map{|n| n.inner_text.strip.gsub(/[ \t]*\n[\n \t]*/, "\n")}}

0 comments on commit 14fdea1

Please sign in to comment.