mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Failing test for mime responder respond_with using a block.
This commit is contained in:
committed by
Prem Sichanugrist
parent
e1a882a15b
commit
5b73a3a5ca
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user