2008-04-05 16:49:18 +00:00
|
|
|
Dir[File.join(File.dirname(__FILE__), "webrat", "*.rb")].each do |file|
|
|
|
|
require File.expand_path(file)
|
|
|
|
end
|
2008-03-03 00:35:46 +00:00
|
|
|
|
2008-04-04 16:12:46 +00:00
|
|
|
module Webrat
|
2008-04-04 15:17:28 +00:00
|
|
|
VERSION = '0.2.1'
|
2008-04-05 16:49:18 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module ActionController
|
|
|
|
module Integration
|
|
|
|
class Session
|
|
|
|
|
|
|
|
unless instance_methods.include?("put_via_redirect")
|
|
|
|
include Webrat::RedirectActions
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_page
|
|
|
|
@current_page ||= Webrat::Page.new(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Issues a GET request for a page, follows any redirects, and verifies the final page
|
|
|
|
# load was successful.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# visits "/"
|
|
|
|
def visits(*args)
|
|
|
|
@current_page = Webrat::Page.new(self, *args)
|
|
|
|
end
|
2008-04-07 23:29:45 +00:00
|
|
|
|
|
|
|
def save_and_open_page
|
|
|
|
current_page.save_and_open
|
|
|
|
end
|
2008-04-05 16:49:18 +00:00
|
|
|
|
2008-04-07 04:52:49 +00:00
|
|
|
[:reloads, :fills_in, :clicks_button, :selects, :chooses, :checks, :unchecks, :clicks_link, :clicks_put_link, :clicks_get_link, :clicks_post_link, :clicks_delete_link].each do |method_name|
|
2008-04-05 16:49:18 +00:00
|
|
|
define_method(method_name) do |*args|
|
|
|
|
current_page.send(method_name, *args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|