1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add and remove renderer inside the test to prevent leak.

This commit is contained in:
Zuhao Wan 2014-05-28 22:24:22 +08:00
parent 0f80a52629
commit 2ba945253b

View file

@ -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