aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/test_process.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-08-01 21:28:17 +0000
committerJamis Buck <jamis@37signals.com>2005-08-01 21:28:17 +0000
commit44c64a612d3313b30a06f6f36e4260f53d4ed852 (patch)
tree9dd87bcf12358126825f8ac40996c39d8d49b520 /actionpack/lib/action_controller/test_process.rb
parent08ebab5d20527d6dd6600445fc5ec280d502596f (diff)
downloadrails-44c64a612d3313b30a06f6f36e4260f53d4ed852.tar.gz
rails-44c64a612d3313b30a06f6f36e4260f53d4ed852.tar.bz2
rails-44c64a612d3313b30a06f6f36e4260f53d4ed852.zip
Use raise instead of assert_not_nil in Test::Unit::TestCase#process to ensure that the test variables (controller, request, response) have been set
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1963 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r--actionpack/lib/action_controller/test_process.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index 581b08d659..5c34e9fa6d 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -269,13 +269,14 @@ module Test
private
# execute the request and set/volley the response
def process(action, parameters = nil, session = nil, flash = nil)
- @request.recycle!
-
- # Sanity check for required instance variables so we can give an understandable error message.
+ # Sanity check for required instance variables so we can give an
+ # understandable error message.
%w(controller request response).each do |iv_name|
- assert_not_nil instance_variable_get("@#{iv_name}"), "@#{iv_name} is nil: make sure you set it in your test's setup method."
+ raise "@#{iv_name} is nil: make sure you set it in your test's setup method." if instance_variable_get("@#{iv_name}").nil?
end
+ @request.recycle!
+
@html_document = nil
@request.env['REQUEST_METHOD'] ||= "GET"
@request.action = action.to_s
@@ -293,7 +294,7 @@ module Test
%w( get post put delete head ).each do |method|
class_eval <<-EOV
def #{method}(action, parameters = nil, session = nil, flash = nil)
- @request.env['REQUEST_METHOD'] = "#{method.upcase}"
+ @request.env['REQUEST_METHOD'] = "#{method.upcase}" if @request
process(action, parameters, session, flash)
end
EOV