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
|
elsif Nokogiri::XML::NodeSet === stringlike
|
||||||
stringlike
|
stringlike
|
||||||
elsif StringIO === stringlike
|
elsif StringIO === stringlike
|
||||||
Nokogiri.parse(stringlike.string)
|
Nokogiri::HTML(stringlike.string)
|
||||||
elsif stringlike.respond_to?(:body)
|
elsif stringlike.respond_to?(:body)
|
||||||
Nokogiri.parse(stringlike.body.to_s)
|
Nokogiri::HTML(stringlike.body.to_s)
|
||||||
else
|
else
|
||||||
Nokogiri.parse(stringlike.to_s)
|
Nokogiri::HTML(stringlike.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,11 +17,6 @@ describe Webrat::Matchers do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#have_xpath" do
|
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
|
it "should be able to match an XPATH" do
|
||||||
@body.should have_xpath("//div")
|
@body.should have_xpath("//div")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user