From c0a372ba87f556769b98a6d06e8c684c3c3156df Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 28 Apr 2009 23:29:29 -0500 Subject: Deprecate template, session, assigns, and layout accessors on response object. Instead access them through the controller instance. This mainly affects functional test assertions. --- .../lib/action_controller/testing/assertions/response.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_controller/testing/assertions/response.rb') diff --git a/actionpack/lib/action_controller/testing/assertions/response.rb b/actionpack/lib/action_controller/testing/assertions/response.rb index a4a3dcdec8..684fe1ffe0 100644 --- a/actionpack/lib/action_controller/testing/assertions/response.rb +++ b/actionpack/lib/action_controller/testing/assertions/response.rb @@ -33,7 +33,7 @@ module ActionController assert_block("") { true } # to count the assertion else if @controller && @response.error? - exception = @controller.response.template.instance_variable_get(:@exception) + exception = @controller.template.instance_variable_get(:@exception) exception_message = exception && exception.message assert_block(build_message(message, "Expected response to be a , but was \n", type, @response.response_code, exception_message.to_s)) { false } else @@ -98,20 +98,20 @@ module ActionController clean_backtrace do case options when NilClass, String - rendered = (@controller.response.rendered[:template] || []).map { |t| t.identifier } + rendered = (@controller.template.rendered[:template] || []).map { |t| t.identifier } msg = build_message(message, "expecting but rendering with ", options, rendered.join(', ')) assert_block(msg) do if options.nil? - @controller.response.rendered[:template].blank? + @controller.template.rendered[:template].blank? else rendered.any? { |t| t.match(options) } end end when Hash if expected_partial = options[:partial] - partials = @controller.response.rendered[:partials] + partials = @controller.template.rendered[:partials] if expected_count = options[:count] found = partials.detect { |p, _| p.identifier.match(expected_partial) } actual_count = found.nil? ? 0 : found.second @@ -126,7 +126,7 @@ module ActionController assert(partials.keys.any? { |p| p.identifier.match(expected_partial) }, msg) end else - assert @controller.response.rendered[:partials].empty?, + assert @controller.template.rendered[:partials].empty?, "Expected no partials to be rendered" end end -- cgit v1.2.3