Parse content as HTML (unless the Content-Type is XML)
This commit is contained in:
parent
4720a79d3c
commit
f92f9bead8
@ -10,11 +10,11 @@ module Webrat
|
||||
elsif Nokogiri::XML::NodeSet === stringlike
|
||||
stringlike
|
||||
elsif StringIO === stringlike
|
||||
Nokogiri.parse(stringlike.string)
|
||||
Nokogiri::HTML(stringlike.string)
|
||||
elsif stringlike.respond_to?(:body)
|
||||
Nokogiri.parse(stringlike.body.to_s)
|
||||
Nokogiri::HTML(stringlike.body.to_s)
|
||||
else
|
||||
Nokogiri.parse(stringlike.to_s)
|
||||
Nokogiri::HTML(stringlike.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -17,11 +17,6 @@ describe Webrat::Matchers do
|
||||
end
|
||||
|
||||
describe "#have_xpath" do
|
||||
it "should work with non-HTML documents" do
|
||||
xml = '<foo bar="baz"></foo>'
|
||||
xml.should have_xpath('/foo[@bar="baz"]')
|
||||
end
|
||||
|
||||
it "should be able to match an XPATH" do
|
||||
@body.should have_xpath("//div")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user