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", "rails_extensions")
require File.join(File.dirname(__FILE__), "webrat", "session") require File.join(File.dirname(__FILE__), "webrat", "session")
class Webrat module Webrat
VERSION = '0.2.1' VERSION = '0.2.1'
end end

View File

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

View File

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