2008-10-25 16:42:38 +00:00
|
|
|
require "rubygems"
|
|
|
|
|
2008-10-25 16:59:21 +00:00
|
|
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
|
|
|
|
2008-04-04 16:12:46 +00:00
|
|
|
module Webrat
|
2008-11-09 02:38:56 +00:00
|
|
|
VERSION = '0.3.2'
|
2008-10-25 16:42:38 +00:00
|
|
|
|
2008-11-07 17:13:41 +00:00
|
|
|
def self.root #:nodoc:
|
2008-04-17 10:52:42 +00:00
|
|
|
defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
|
|
|
|
end
|
2008-11-10 19:15:40 +00:00
|
|
|
|
|
|
|
class WebratError < StandardError
|
|
|
|
end
|
2008-04-05 16:49:18 +00:00
|
|
|
end
|
|
|
|
|
2008-11-11 05:28:15 +00:00
|
|
|
# We need Nokogiri's CSS to XPath support, even if using REXML and Hpricot for parsing and searching
|
2008-11-07 07:49:48 +00:00
|
|
|
require "nokogiri/css"
|
|
|
|
|
2008-11-11 05:28:15 +00:00
|
|
|
# Require nokogiri and fall back on rexml+Hpricot
|
2008-11-07 07:49:48 +00:00
|
|
|
begin
|
|
|
|
require "nokogiri"
|
|
|
|
require "webrat/core/nokogiri"
|
|
|
|
rescue LoadError => e
|
2008-11-11 05:28:15 +00:00
|
|
|
require "hpricot"
|
2008-11-07 07:49:48 +00:00
|
|
|
require "rexml/document"
|
|
|
|
end
|
|
|
|
|
2008-10-25 16:59:21 +00:00
|
|
|
require "webrat/core"
|
2008-10-25 16:42:38 +00:00
|
|
|
|
2008-11-05 23:01:05 +00:00
|
|
|
# TODO: This is probably not a good idea.
|
|
|
|
# Probably better for webrat users to require "webrat/rails" etc. directly
|
|
|
|
if defined?(RAILS_ENV)
|
|
|
|
require "webrat/rails"
|
|
|
|
end
|