diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-01 14:53:39 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-01 14:53:39 -0600 |
commit | 44587b7faeb2bf2962e9a2e824c341ff1e3f9add (patch) | |
tree | 9a97a90bffca68ab8e0f13003e4590ca9f1a93a2 /actionpack/test/controller/mime_responds_test.rb | |
parent | 61a31f3d3dae55b3ed2a49fafcbfe45b77ea3be2 (diff) | |
parent | 0c4990b5f4b8c99ea656170eff9bb9c3490de642 (diff) | |
download | rails-44587b7faeb2bf2962e9a2e824c341ff1e3f9add.tar.gz rails-44587b7faeb2bf2962e9a2e824c341ff1e3f9add.tar.bz2 rails-44587b7faeb2bf2962e9a2e824c341ff1e3f9add.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack/test/controller/mime_responds_test.rb')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index fee9cf46f9..c1fa74b8c8 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -507,6 +507,13 @@ class RespondWithController < ActionController::Base end end + def using_responder_with_respond + responder = Class.new(ActionController::Responder) do + def respond; @controller.render :text => "respond #{format}"; end + end + respond_with(Customer.new("david", 13), :responder => responder) + end + protected def _render_js(js, options) @@ -735,6 +742,16 @@ class RespondWithControllerTest < ActionController::TestCase assert_equal "foo - #{[:html].to_s}", @controller.response_body end + def test_respond_as_responder_entry_point + @request.accept = "text/html" + get :using_responder_with_respond + assert_equal "respond html", @response.body + + @request.accept = "application/xml" + get :using_responder_with_respond + assert_equal "respond xml", @response.body + end + def test_clear_respond_to @controller = InheritedRespondWithController.new @request.accept = "text/html" |