2009-05-13 20:00:36 -04:00
|
|
|
require 'abstract_unit'
|
|
|
|
|
2009-12-09 16:38:47 -05:00
|
|
|
|
2009-09-19 14:04:12 -04:00
|
|
|
class RenderOtherTest < ActionController::TestCase
|
|
|
|
class TestController < ActionController::Base
|
2009-12-09 16:38:47 -05:00
|
|
|
def render_simon_says
|
|
|
|
render :simon => "foo"
|
|
|
|
end
|
2009-09-19 14:04:12 -04:00
|
|
|
end
|
2009-05-13 20:00:36 -04:00
|
|
|
|
|
|
|
tests TestController
|
|
|
|
|
2009-12-09 16:38:47 -05:00
|
|
|
def test_using_custom_render_option
|
2014-05-28 10:24:22 -04:00
|
|
|
ActionController.add_renderer :simon do |says, options|
|
|
|
|
self.content_type = Mime::TEXT
|
|
|
|
self.response_body = "Simon says: #{says}"
|
|
|
|
end
|
|
|
|
|
2009-12-09 16:38:47 -05:00
|
|
|
get :render_simon_says
|
|
|
|
assert_equal "Simon says: foo", @response.body
|
2014-05-28 10:24:22 -04:00
|
|
|
ensure
|
|
|
|
ActionController.remove_renderer :simon
|
2009-12-09 16:38:47 -05:00
|
|
|
end
|
2009-09-19 14:04:12 -04:00
|
|
|
end
|