Skip to content

Commit

Permalink
Always deal with one query selector (a String, not an Array)
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Feb 24, 2009
1 parent dad3da1 commit aec889a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/webrat/core/matchers/have_xpath.rb
Expand Up @@ -37,7 +37,7 @@ def rexml_matches(stringlike)
@query = query
end

add_options_conditions_to(@query.first)
add_options_conditions_to(@query)

@document = Webrat.rexml_document(stringlike)

Expand All @@ -52,12 +52,12 @@ def rexml_matches(stringlike)

def nokogiri_matches(stringlike)
if Nokogiri::XML::NodeSet === stringlike
@query = query.map { |q| q.gsub(%r'//', './') }
@query = query.gsub(%r'//', './')
else
@query = query
end

add_options_conditions_to(@query.first)
add_options_conditions_to(@query)

@document = Webrat::XML.document(stringlike)
@document.xpath(*@query)
Expand Down Expand Up @@ -88,7 +88,7 @@ def add_content_condition_to(query)
end

def query
[@expected].flatten.compact
@expected
end

# ==== Returns
Expand Down

0 comments on commit aec889a

Please sign in to comment.