Update requires to fix compatibility with Nokogiri 1.1.0
This commit is contained in:
parent
859a15b8d8
commit
95e3260142
|
@ -8,20 +8,27 @@ module Webrat
|
|||
def self.root #:nodoc:
|
||||
defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
|
||||
end
|
||||
|
||||
def self.require_xml
|
||||
gem "nokogiri", ">= 1.1.0"
|
||||
|
||||
if on_java?
|
||||
# We need Nokogiri's CSS to XPath support, even if using REXML and Hpricot for parsing and searching
|
||||
require "nokogiri/css"
|
||||
require "hpricot"
|
||||
require "rexml/document"
|
||||
else
|
||||
require "nokogiri"
|
||||
require "webrat/core/nokogiri"
|
||||
end
|
||||
end
|
||||
|
||||
def self.on_java?
|
||||
RUBY_PLATFORM =~ /java/
|
||||
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
|
||||
|
||||
Webrat.require_xml
|
||||
require "webrat/core"
|
||||
|
||||
# TODO: This is probably not a good idea.
|
||||
|
|
Loading…
Reference in New Issue