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.
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
module Webrat
module RedirectActions
def put_via_redirect(path, parameters = {}, headers = {})
put path, parameters, headers
follow_redirect! while redirect?
status
end
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

File diff suppressed because it is too large Load Diff