diff --git a/lib/webrat/rails_extensions.rb b/lib/webrat/rails_extensions.rb index 2f89cf1..bedd37d 100644 --- a/lib/webrat/rails_extensions.rb +++ b/lib/webrat/rails_extensions.rb @@ -2,18 +2,23 @@ module ActionController module Integration class Session - # 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 + + 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 - # 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 + 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 diff --git a/lib/webrat/session.rb b/lib/webrat/session.rb index 28fe945..2a7bfc2 100644 --- a/lib/webrat/session.rb +++ b/lib/webrat/session.rb @@ -454,7 +454,7 @@ module ActionController end 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 @dom = Hpricot(response.body) add_default_params diff --git a/test/helper.rb b/test/helper.rb index 34ddb3b..50351d5 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -4,9 +4,13 @@ require "test/unit" begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end require "mocha" + require "active_support" -require "action_controller" -require "action_controller/integration" + +silence_warnings do + require "action_controller" + require "action_controller/integration" +end require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat")