diff --git a/lib/webrat/core/nokogiri.rb b/lib/webrat/core/nokogiri.rb index 51fe87d..2b8e575 100644 --- a/lib/webrat/core/nokogiri.rb +++ b/lib/webrat/core/nokogiri.rb @@ -10,11 +10,11 @@ module Webrat elsif Nokogiri::XML::NodeSet === stringlike stringlike elsif StringIO === stringlike - Nokogiri::HTML(stringlike.string) + Nokogiri.parse(stringlike.string) elsif stringlike.respond_to?(:body) - Nokogiri::HTML(stringlike.body.to_s) + Nokogiri.parse(stringlike.body.to_s) else - Nokogiri::HTML(stringlike.to_s) + Nokogiri.parse(stringlike.to_s) end end diff --git a/spec/api/click_button_spec.rb b/spec/api/click_button_spec.rb index 4a337b0..a0c1e81 100644 --- a/spec/api/click_button_spec.rb +++ b/spec/api/click_button_spec.rb @@ -91,12 +91,14 @@ describe "click_button" do it "should submit the form with the specified button" do @session.response_body = <<-EOS -
- -
-
- -
+ +
+ +
+
+ +
+ EOS @session.should_receive(:get).with("/form2", {}) @session.click_button "Form2" diff --git a/spec/api/click_link_spec.rb b/spec/api/click_link_spec.rb index 913b9bc..993bd2b 100644 --- a/spec/api/click_link_spec.rb +++ b/spec/api/click_link_spec.rb @@ -254,8 +254,10 @@ describe "click_link" do it "should choose the shortest link text match" do @session.response_body = <<-EOS - Linkerama - Link + + Linkerama + Link + EOS @session.should_receive(:get).with("/page2", {}) @@ -264,7 +266,9 @@ describe "click_link" do it "should treat non-breaking spaces as spaces" do @session.response_body = <<-EOS - This is a link + + This is a link + EOS @session.should_receive(:get).with("/page1", {}) @@ -284,10 +288,12 @@ describe "click_link" do it "should click link within a selector" do @session.response_body = <<-EOS + Link
Link
+ EOS @session.should_receive(:get).with("/page2", {}) diff --git a/spec/api/matchers_spec.rb b/spec/api/matchers_spec.rb index a3e86d1..1cfbe5c 100644 --- a/spec/api/matchers_spec.rb +++ b/spec/api/matchers_spec.rb @@ -18,7 +18,6 @@ describe Webrat::Matchers do describe "#have_xpath" do it "should work with non-HTML documents" do - pending "Bugfix" xml = '' xml.should have_xpath('/foo[@bar="baz"]') end diff --git a/spec/api/within_spec.rb b/spec/api/within_spec.rb index c093f4b..d9461e6 100644 --- a/spec/api/within_spec.rb +++ b/spec/api/within_spec.rb @@ -7,12 +7,14 @@ describe "within" do it "should work when nested" do @session.response_body = <<-EOS +
Link
Link
+ EOS @session.should_receive(:get).with("/page2", {}) @@ -25,10 +27,12 @@ describe "within" do it "should click links within a scope" do @session.response_body = <<-EOS + Link
Link
+ EOS @session.should_receive(:get).with("/page2", {}) @@ -39,6 +43,7 @@ describe "within" do it "should submit forms within a scope" do @session.response_body = <<-EOS +