2009-12-20 15:22:47 +00:00
|
|
|
require 'timeout'
|
2009-11-16 21:02:16 +00:00
|
|
|
require 'nokogiri'
|
|
|
|
|
|
|
|
module Capybara
|
2010-01-11 21:16:59 +00:00
|
|
|
VERSION = '0.3.0'
|
2009-11-16 21:02:16 +00:00
|
|
|
|
|
|
|
class CapybaraError < StandardError; end
|
|
|
|
class DriverNotFoundError < CapybaraError; end
|
|
|
|
class ElementNotFound < CapybaraError; end
|
2010-01-30 00:02:26 +00:00
|
|
|
class OptionNotFound < ElementNotFound; end
|
2009-12-12 12:33:00 +00:00
|
|
|
class NotSupportedByDriverError < CapybaraError; end
|
2009-12-31 18:51:22 +00:00
|
|
|
class TimeoutError < CapybaraError; end
|
2010-01-11 20:30:58 +00:00
|
|
|
class InfiniteRedirectError < TimeoutError; end
|
2009-12-31 18:51:22 +00:00
|
|
|
|
2009-11-16 21:02:16 +00:00
|
|
|
class << self
|
2010-01-17 16:40:26 +00:00
|
|
|
attr_accessor :debug, :asset_root, :app_host, :run_server
|
|
|
|
attr_accessor :default_selector, :default_wait_time
|
2009-12-12 12:33:00 +00:00
|
|
|
|
2009-11-16 21:02:16 +00:00
|
|
|
def log(message)
|
|
|
|
puts "[capybara] #{message}" if debug
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-12-24 05:41:34 +00:00
|
|
|
autoload :Server, 'capybara/server'
|
|
|
|
autoload :Session, 'capybara/session'
|
|
|
|
autoload :Node, 'capybara/node'
|
|
|
|
autoload :XPath, 'capybara/xpath'
|
|
|
|
autoload :Searchable, 'capybara/searchable'
|
|
|
|
|
2009-11-16 21:02:16 +00:00
|
|
|
module Driver
|
2009-12-09 20:43:40 +00:00
|
|
|
autoload :Base, 'capybara/driver/base'
|
2009-11-16 21:02:16 +00:00
|
|
|
autoload :RackTest, 'capybara/driver/rack_test_driver'
|
2009-12-16 20:42:37 +00:00
|
|
|
autoload :Celerity, 'capybara/driver/celerity_driver'
|
2009-12-18 16:40:51 +00:00
|
|
|
autoload :Culerity, 'capybara/driver/culerity_driver'
|
2009-11-16 21:02:16 +00:00
|
|
|
autoload :Selenium, 'capybara/driver/selenium_driver'
|
|
|
|
end
|
|
|
|
end
|
2010-01-17 16:40:26 +00:00
|
|
|
|
|
|
|
Capybara.run_server = true
|
|
|
|
Capybara.default_selector = :xpath
|
|
|
|
Capybara.default_wait_time = 2
|