From 5fc17535461f85368e0486dc7290f7a169fdf564 Mon Sep 17 00:00:00 2001 From: Sam Elliott Date: Wed, 2 Mar 2011 08:54:36 +0000 Subject: [PATCH] Fix warnings in actionmailer tests: - warning about redefined method default_url_options solved by moving that method above the inclusion of ActionDispatch::Routing::UrlFor, because this module can cope with the method being defined before its inclusion - warning about @integration_session not being initialized. Solved by initializing it if not already in a setup callback. This breaks no tests. - warning about @_etag solved by setting it to the header immediately --- actionpack/lib/action_dispatch/http/response.rb | 2 ++ .../lib/action_dispatch/testing/integration.rb | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index ff5e96f..c4979e7 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -58,6 +58,8 @@ module ActionDispatch # :nodoc: @charset = charset || "UTF-8" end + @_etag = self["ETag"] + yield self if block_given? end end diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 09eb886..0f4cfba 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -167,6 +167,10 @@ module ActionDispatch # A running counter of the number of requests processed. attr_accessor :request_count + def default_url_options + { :host => host, :protocol => https? ? "https" : "http" } + end + include ActionDispatch::Routing::UrlFor # Create and initialize a new Session instance. @@ -182,10 +186,6 @@ module ActionDispatch reset! end - def default_url_options - { :host => host, :protocol => https? ? "https" : "http" } - end - # Resets the instance. This can be used to reset the state information # in an existing session instance, so it can be used from a clean-slate # condition. @@ -356,6 +356,12 @@ module ActionDispatch extend ActiveSupport::Concern include ActionDispatch::Routing::UrlFor + included do + setup do + @integration_session ||= nil + end + end + def url_options reset! unless @integration_session @integration_session.url_options -- 1.7.4.1