Moving require of nokogiri to webrat.rb
This commit is contained in:
parent
c01f44a32c
commit
e5b0e77332
@ -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.
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user