diff options
author | Mario Visic <mario@mariovisic.com> | 2012-03-05 22:26:45 +0800 |
---|---|---|
committer | Prem Sichanugrist <s@sikachu.com> | 2012-03-05 21:09:36 -0500 |
commit | 5b73a3a5ca52043e67b448dc413aab9b8ccd1073 (patch) | |
tree | a034b40e5553743556407dda34400af18c7acead /actionpack | |
parent | e1a882a15b71435ec82a596978429b34d4c73ac5 (diff) | |
download | rails-5b73a3a5ca52043e67b448dc413aab9b8ccd1073.tar.gz rails-5b73a3a5ca52043e67b448dc413aab9b8ccd1073.tar.bz2 rails-5b73a3a5ca52043e67b448dc413aab9b8ccd1073.zip |
Failing test for mime responder respond_with using a block.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 7c4fb59c15..f00ddb1799 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -1152,3 +1152,39 @@ class MimeControllerLayoutsTest < ActionController::TestCase assert_equal '<html><div id="super_iphone">Super iPhone</div></html>', @response.body end end + +class FlashResponder < ActionController::Responder + def initialize(controller, resources, options={}) + super + end + + def to_html + controller.flash[:notice] = 'Success' + super + end +end + +class FlashResponderController < ActionController::Base + self.responder = FlashResponder + respond_to :html + + def index + respond_with Object.new do |format| + format.html { render :text => 'HTML' } + end + end +end + +class FlashResponderControllerTest < ActionController::TestCase + tests FlashResponderController + + def test_respond_with_block_executed + get :index + assert_equal 'HTML', @response.body + end + + def test_flash_responder_executed + get :index + assert_equal 'Success', flash[:notice] + end +end |