Skip to content
Browse files

Got controller/render_js_test.rb to pass on new base

  • Loading branch information...
1 parent 3a72b55 commit 7b3fb1d43f57d6ebe3edb75434cae01e140483d0 Yehuda Katz + Carl Lerche committed May 22, 2009
View
7 actionpack/Rakefile
@@ -65,17 +65,16 @@ Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
# ==== Not ported
# * filters
# * integration
- # * render_js
# * test
# * view_paths
t.test_files = %w(
action_pack_assertions addresses_render assert_select
base benchmark caching capture content_type cookie dispatcher
filter_params flash helper http_basic_authentication
http_digest_authentication layout logging mime_responds
- record_identifier redirect render render_json render_other render_xml
- request_forgery_protection rescue resources routing selector send_file
- translation url_rewriter verification webservice
+ record_identifier redirect render render_js render_json
+ render_other render_xml request_forgery_protection rescue
+ resources routing selector send_file url_rewriter verification webservice
).map { |name| "test/controller/#{name}_test.rb" }
t.verbose = true
end
View
1 actionpack/lib/action_controller/new_base/base.rb
@@ -12,6 +12,7 @@ class Base < Http
include ActionController::Redirector
include ActionController::Renderer
include ActionController::Renderers::Json
+ include ActionController::Renderers::Js
include ActionController::Renderers::Xml
include ActionController::Renderers::Rjs
include ActionController::Layouts
View
10 actionpack/lib/action_controller/new_base/render_options.rb
@@ -62,6 +62,16 @@ def _render_json(json, options)
end
end
+ module Js
+ include RenderOption
+ register_renderer :js
+
+ def _render_js(js, options)
+ response.content_type ||= Mime::JS
+ self.response_body = js
+ end
+ end
+
module Xml
include RenderOption
register_renderer :xml
View
2 actionpack/test/controller/render_js_test.rb
@@ -19,6 +19,8 @@ def partial
end
class RenderTest < ActionController::TestCase
+ tests TestController
+
def test_render_vanilla_js
get :render_vanilla_js_hello
assert_equal "alert('hello')", @response.body

0 comments on commit 7b3fb1d

Please sign in to comment.
Something went wrong with that request. Please try again.