Permalink
Browse files

Merge pull request #15385 from zuhao/refactor_actionpack_render_other…

…_test

Add and remove renderer inside the test to prevent leak.
  • Loading branch information...
2 parents b22b188 + 2ba9452 commit c711c90bae821a57523d99b526b22e84a1562ead @spastorino spastorino committed May 28, 2014
Showing with 7 additions and 4 deletions.
  1. +7 −4 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 @@ def render_simon_says
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

0 comments on commit c711c90

Please sign in to comment.