parse_with_nokogiri default to true on MRI and false on JRuby

This commit is contained in:
Bryan Helmkamp 2008-11-23 14:49:05 -05:00
parent 302f0dc1c6
commit 1017fdfba7
2 changed files with 10 additions and 3 deletions

View File

@ -21,7 +21,7 @@ module Webrat
def initialize def initialize
self.open_error_files = true self.open_error_files = true
self.parse_with_nokogiri = true self.parse_with_nokogiri = !Webrat.on_java?
end end
end end

View File

@ -14,12 +14,19 @@ describe Webrat::Configuration do
end end
it "should use Nokogiri as the parser by default" do it "should use Nokogiri as the parser by default" do
config = Webrat.configuration Webrat.stub!(:on_java? => false)
config = Webrat::Configuration.new
config.parse_with_nokogiri.should == true config.parse_with_nokogiri.should == true
end end
it "should not use Nokogiri as the parser when on JRuby" do
Webrat.stub!(:on_java? => true)
config = Webrat::Configuration.new
config.parse_with_nokogiri.should == false
end
it "should open error files by default" do it "should open error files by default" do
config = Webrat.configuration config = Webrat::Configuration.new
config.open_error_files.should == true config.open_error_files.should == true
end end