public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Test for assert_response for failure response without an exception. [#141 
state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
cch1 (author)
Fri May 16 08:27:09 -0700 2008
lifo (committer)
Mon May 19 03:20:36 -0700 2008
commit  e6f5079a48094eeba3dab9dca52b16b58ddc3634
tree    d3acbe17454f6f3995eff4314d36440ddaa089de
parent  99860b72aebe0348f41e82d4710343498d89a84b
...
131
132
133
 
 
 
 
134
135
136
...
483
484
485
 
 
 
 
 
 
 
 
 
 
486
487
488
...
131
132
133
134
135
136
137
138
139
140
...
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
0
@@ -131,6 +131,10 @@ class AssertResponseWithUnexpectedErrorController < ActionController::Base
0
   def index
0
     raise 'FAIL'
0
   end
0
+
0
+  def show
0
+    render :text => "Boom", :status => 500
0
+  end
0
 end
0
 
0
 module Admin
0
@@ -483,6 +487,16 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
0
   rescue Test::Unit::AssertionFailedError => e
0
     assert e.message.include?('FAIL')
0
   end
0
+
0
+  def test_assert_response_failure_response_with_no_exception
0
+    @controller = AssertResponseWithUnexpectedErrorController.new
0
+    get :show
0
+    assert_response :success
0
+    flunk 'Expected non-success response'
0
+  rescue Test::Unit::AssertionFailedError
0
+  rescue
0
+    flunk "assert_response failed to handle failure response with missing, but optional, exception."
0
+  end
0
 end
0
 
0
 class ActionPackHeaderTest < Test::Unit::TestCase

Comments