diff options
author | Zuhao Wan <wanzuhao@gmail.com> | 2014-05-28 22:24:22 +0800 |
---|---|---|
committer | Zuhao Wan <wanzuhao@gmail.com> | 2014-05-28 22:24:22 +0800 |
commit | 2ba945253bffb1e6a55ded601d62c95a6acde4a1 (patch) | |
tree | c5afc17c5ae52c2e798db412d267ef94b49853fe /actionpack | |
parent | 0f80a5262964c27b3204c8179d37f91c64ceb6f6 (diff) | |
download | rails-2ba945253bffb1e6a55ded601d62c95a6acde4a1.tar.gz rails-2ba945253bffb1e6a55ded601d62c95a6acde4a1.tar.bz2 rails-2ba945253bffb1e6a55ded601d62c95a6acde4a1.zip |
Add and remove renderer inside the test to prevent leak.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/controller/render_other_test.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/actionpack/test/controller/render_other_test.rb b/actionpack/test/controller/render_other_test.rb index b5e74e373d..af50e11261 100644 --- a/actionpack/test/controller/render_other_test.rb +++ b/actionpack/test/controller/render_other_test.rb @@ -1,9 +1,5 @@ require 'abstract_unit' -ActionController.add_renderer :simon do |says, options| - self.content_type = Mime::TEXT - self.response_body = "Simon says: #{says}" -end class RenderOtherTest < ActionController::TestCase class TestController < ActionController::Base @@ -15,7 +11,14 @@ class RenderOtherTest < ActionController::TestCase tests TestController def test_using_custom_render_option + ActionController.add_renderer :simon do |says, options| + self.content_type = Mime::TEXT + self.response_body = "Simon says: #{says}" + end + get :render_simon_says assert_equal "Simon says: foo", @response.body + ensure + ActionController.remove_renderer :simon end end |