aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/testing/assertions/response.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-04-28 23:29:29 -0500
committerJoshua Peek <josh@joshpeek.com>2009-04-28 23:29:46 -0500
commitc0a372ba87f556769b98a6d06e8c684c3c3156df (patch)
treeac64ad4c56383731ba822088ffe4a697e77ef4ac /actionpack/lib/action_controller/testing/assertions/response.rb
parent8925e89c6307b8b7c8aeb0277ae5e059904b2fc6 (diff)
downloadrails-c0a372ba87f556769b98a6d06e8c684c3c3156df.tar.gz
rails-c0a372ba87f556769b98a6d06e8c684c3c3156df.tar.bz2
rails-c0a372ba87f556769b98a6d06e8c684c3c3156df.zip
Deprecate template, session, assigns, and layout accessors on response object. Instead access them through the controller instance. This mainly affects functional test assertions.
Diffstat (limited to 'actionpack/lib/action_controller/testing/assertions/response.rb')
-rw-r--r--actionpack/lib/action_controller/testing/assertions/response.rb10
1 files changed, 5 insertions, 5 deletions
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