Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Failing test for mime responder respond_with using a block.

  • Loading branch information...
commit 5b73a3a5ca52043e67b448dc413aab9b8ccd1073 1 parent e1a882a
@mariovisic mariovisic authored sikachu committed
Showing with 36 additions and 0 deletions.
  1. +36 −0 actionpack/test/controller/mime_responds_test.rb
View
36 actionpack/test/controller/mime_responds_test.rb
@@ -1152,3 +1152,39 @@ def test_format_with_inherited_layouts
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
Please sign in to comment.
Something went wrong with that request. Please try again.