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:
|
def self.root #:nodoc:
|
||||||
defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
|
defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# We need Nokogiri's CSS to XPath support, even if using REXML
|
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 "nokogiri/css"
|
||||||
|
require "hpricot"
|
||||||
# Require nokogiri and fall back on rexml
|
require "rexml/document"
|
||||||
begin
|
else
|
||||||
require "nokogiri"
|
require "nokogiri"
|
||||||
require "webrat/core/nokogiri"
|
require "webrat/core/nokogiri"
|
||||||
rescue LoadError => e
|
end
|
||||||
require "rexml/document"
|
|
||||||
warn("Standard REXML library is slow. Please consider installing nokogiri.\nUse \"sudo gem install nokogiri\"")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.on_java?
|
||||||
|
RUBY_PLATFORM =~ /java/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Webrat.require_xml
|
||||||
require "webrat/core"
|
require "webrat/core"
|
||||||
|
|
||||||
# TODO: This is probably not a good idea.
|
# TODO: This is probably not a good idea.
|
||||||
|
|
Loading…
Reference in New Issue