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:
parent
0f80a52629
commit
2ba945253b
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue