diff options
author | Mario Visic <mario@mariovisic.com> | 2012-03-05 22:26:45 +0800 |
---|---|---|
committer | Prem Sichanugrist <s@sikachu.com> | 2012-03-05 20:21:01 -0500 |
commit | 4c31ba93863e538d65c07f55e0c6ea356aee8f3a (patch) | |
tree | cf5ce363762228a32fcd260cd2e7a43c2927a7b0 /actionpack/test/controller | |
parent | dc8071520761d954d0958316a45aa9223b70a3d1 (diff) | |
download | rails-4c31ba93863e538d65c07f55e0c6ea356aee8f3a.tar.gz rails-4c31ba93863e538d65c07f55e0c6ea356aee8f3a.tar.bz2 rails-4c31ba93863e538d65c07f55e0c6ea356aee8f3a.zip |
Failing test for mime responder respond_with using a block.
Diffstat (limited to 'actionpack/test/controller')
-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 ae368842b5..f618d4889d 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -1183,3 +1183,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 |