Use modules for webrat extension

This commit is contained in:
Bryan Helmkamp 2008-04-04 17:12:46 +01:00
parent a0ea353e42
commit 9adf2193d2
3 changed files with 525 additions and 524 deletions

View File

@ -1,6 +1,6 @@
require File.join(File.dirname(__FILE__), "webrat", "rails_extensions")
require File.join(File.dirname(__FILE__), "webrat", "session")
class Webrat
module Webrat
VERSION = '0.2.1'
end

View File

@ -1,27 +1,25 @@
module ActionController
module Integration
class Session
unless instance_methods.include?("put_via_redirect")
# Waiting for http://dev.rubyonrails.org/ticket/10497 to be committed.
module Webrat
module RedirectActions
def put_via_redirect(path, parameters = {}, headers = {})
put path, parameters, headers
follow_redirect! while redirect?
status
end
end
unless instance_methods.include?("delete_via_redirect")
# Waiting for http://dev.rubyonrails.org/ticket/10497 to be committed.
def delete_via_redirect(path, parameters = {}, headers = {})
delete path, parameters, headers
follow_redirect! while redirect?
status
end
end
end
# Waiting for http://dev.rubyonrails.org/ticket/10497 to be committed.
module ActionController
module Integration
class Session
include Webrat::RedirectActions unless instance_methods.include?("put_via_redirect")
end
end
end

View File

@ -1,10 +1,8 @@
require "hpricot"
require "English"
module ActionController
module Integration
class Session
module Webrat
module Session
# Issues a GET request for a page, follows any redirects, and verifies the final page
# load was successful.
#
@ -516,8 +514,13 @@ module ActionController
nil
end
end
end
end
end
module ActionController
module Integration
class Session
include Webrat::Session
end
end
end