Moving require of nokogiri to webrat.rb

This commit is contained in:
Bryan Helmkamp 2008-11-07 02:49:48 -05:00
parent c01f44a32c
commit e5b0e77332
3 changed files with 12 additions and 23 deletions

View File

@ -10,6 +10,18 @@ module Webrat
end end
end end
# We need Nokogiri's CSS to XPath support, even if using REXML
require "nokogiri/css"
# Require nokogiri and fall back on rexml
begin
require "nokogiri"
require "webrat/core/nokogiri"
rescue LoadError => e
require "rexml/document"
warn("Standard REXML library is slow. Please consider installing nokogiri.\nUse \"sudo gem install nokogiri\"")
end
require "webrat/core" require "webrat/core"
# TODO: This is probably not a good idea. # TODO: This is probably not a good idea.

View File

@ -3,17 +3,6 @@ module Webrat
class HasContent class HasContent
def initialize(content) def initialize(content)
# We need Nokogiri's CSS to XPath support, even if using REXML
require "nokogiri/css"
begin
require "nokogiri"
require "webrat/core/nokogiri"
rescue LoadError => e
require "rexml/document"
warn("Standard REXML library is slow. Please consider installing nokogiri.\nUse \"sudo gem install nokogiri\"")
end
@content = content @content = content
end end

View File

@ -3,18 +3,6 @@ module Webrat
class HaveXpath class HaveXpath
def initialize(expected, &block) def initialize(expected, &block)
# We need Nokogiri's CSS to XPath support, even if using REXML
require "nokogiri/css"
# Require nokogiri and fall back on rexml
begin
require "nokogiri"
require "webrat/core/nokogiri"
rescue LoadError => e
require "rexml/document"
warn("Standard REXML library is slow. Please consider installing nokogiri.\nUse \"sudo gem install nokogiri\"")
end
@expected = expected @expected = expected
@block = block @block = block
end end