Avoid warning when running tests

This commit is contained in:
Bryan Helmkamp 2008-04-04 14:19:14 +01:00
parent f7420463fd
commit a9d89d23df
3 changed files with 22 additions and 13 deletions

View File

@ -2,19 +2,24 @@ module ActionController
module Integration module Integration
class Session class Session
unless instance_methods.include?("put_via_redirect")
# Waiting for http://dev.rubyonrails.org/ticket/10497 to be committed. # 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. # 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

View File

@ -454,7 +454,7 @@ module ActionController
end end
def dom # :nodoc: def dom # :nodoc:
return @dom if @dom return @dom if defined?(@dom) && @dom
raise "You must visit a path before working with the page." unless response raise "You must visit a path before working with the page." unless response
@dom = Hpricot(response.body) @dom = Hpricot(response.body)
add_default_params add_default_params

View File

@ -4,9 +4,13 @@ require "test/unit"
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
require "mocha" require "mocha"
require "active_support" require "active_support"
silence_warnings do
require "action_controller" require "action_controller"
require "action_controller/integration" require "action_controller/integration"
end
require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat") require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat")