Skip to content

Commit

Permalink
Changing requiring of nokogiri to work on jruby
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Nov 17, 2008
1 parent 1bdead1 commit 3abaa92
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/webrat.rb
Expand Up @@ -14,16 +14,14 @@ def self.root #:nodoc:

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"
Expand Down

0 comments on commit 3abaa92

Please sign in to comment.