diff options
| author | Jamis Buck <jamis@37signals.com> | 2005-08-01 21:28:17 +0000 |
|---|---|---|
| committer | Jamis Buck <jamis@37signals.com> | 2005-08-01 21:28:17 +0000 |
| commit | 44c64a612d3313b30a06f6f36e4260f53d4ed852 (patch) | |
| tree | 9dd87bcf12358126825f8ac40996c39d8d49b520 /actionpack/test | |
| parent | 08ebab5d20527d6dd6600445fc5ec280d502596f (diff) | |
| download | rails-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/test')
| -rw-r--r-- | actionpack/test/controller/test_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 570f92e6e4..fff1393872 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -177,4 +177,21 @@ HTML get :test_remote_addr assert_equal "192.0.0.1", @response.body end + + %w(controller response request).each do |variable| + %w(get post put delete head process).each do |method| + define_method("test_#{variable}_missing_for_#{method}_raises_error") do + remove_instance_variable "@#{variable}" + begin + send(method, :test_remote_addr) + assert false, "expected RuntimeError, got nothing" + rescue RuntimeError => error + assert true + assert_match %r{@#{variable} is nil}, error.message + rescue => error + assert false, "expected RuntimeError, got #{error.class}" + end + end + end + end end |
