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
|
||||||
require "nokogiri/css"
|
gem "nokogiri", ">= 1.1.0"
|
||||||
|
|
||||||
# Require nokogiri and fall back on rexml
|
if on_java?
|
||||||
begin
|
# 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 "nokogiri"
|
||||||
require "webrat/core/nokogiri"
|
require "webrat/core/nokogiri"
|
||||||
rescue LoadError => e
|
end
|
||||||
require "rexml/document"
|
end
|
||||||
warn("Standard REXML library is slow. Please consider installing nokogiri.\nUse \"sudo gem install nokogiri\"")
|
|
||||||
|
def self.on_java?
|
||||||
|
RUBY_PLATFORM =~ /java/
|
||||||
|
end
|
||||||
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