From 3abaa924cc289dde19e004ae27292d0159e2b606 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 17 Nov 2008 00:05:57 -0500 Subject: [PATCH] Changing requiring of nokogiri to work on jruby --- lib/webrat.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/webrat.rb b/lib/webrat.rb index d1c5771..4060933 100644 --- a/lib/webrat.rb +++ b/lib/webrat.rb @@ -14,16 +14,14 @@ module Webrat end -# We need Nokogiri's CSS to XPath support, even if using REXML and Hpricot for parsing and searching -require "nokogiri/css" - -# Require nokogiri and fall back on rexml+Hpricot -begin - require "nokogiri" - require "webrat/core/nokogiri" -rescue LoadError => e +if RUBY_PLATFORM =~ /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 require "webrat/core"