aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-22 17:07:40 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-22 17:08:58 -0700
commit7b3fb1d43f57d6ebe3edb75434cae01e140483d0 (patch)
tree746afe7ee685cdf0750443d7afde9d838cbbe22b
parent3a72b55229f63d2cba3337c39cd118cf532ebbbc (diff)
downloadrails-7b3fb1d43f57d6ebe3edb75434cae01e140483d0.tar.gz
rails-7b3fb1d43f57d6ebe3edb75434cae01e140483d0.tar.bz2
rails-7b3fb1d43f57d6ebe3edb75434cae01e140483d0.zip
Got controller/render_js_test.rb to pass on new base
-rw-r--r--actionpack/Rakefile7
-rw-r--r--actionpack/lib/action_controller/new_base/base.rb1
-rw-r--r--actionpack/lib/action_controller/new_base/render_options.rb10
-rw-r--r--actionpack/test/controller/render_js_test.rb2
4 files changed, 16 insertions, 4 deletions
diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index ea12adb921..b9819d4a83 100644
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -65,7 +65,6 @@ Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
# ==== Not ported
# * filters
# * integration
- # * render_js
# * test
# * view_paths
t.test_files = %w(
@@ -73,9 +72,9 @@ Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
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
diff --git a/actionpack/lib/action_controller/new_base/base.rb b/actionpack/lib/action_controller/new_base/base.rb
index e321d97ac1..adb760ea7e 100644
--- a/actionpack/lib/action_controller/new_base/base.rb
+++ b/actionpack/lib/action_controller/new_base/base.rb
@@ -12,6 +12,7 @@ module ActionController
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
diff --git a/actionpack/lib/action_controller/new_base/render_options.rb b/actionpack/lib/action_controller/new_base/render_options.rb
index 2ce9d0c7ae..33f8957f6e 100644
--- a/actionpack/lib/action_controller/new_base/render_options.rb
+++ b/actionpack/lib/action_controller/new_base/render_options.rb
@@ -62,6 +62,16 @@ module ActionController
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
diff --git a/actionpack/test/controller/render_js_test.rb b/actionpack/test/controller/render_js_test.rb
index 7b50242910..d02fd3fd4c 100644
--- a/actionpack/test/controller/render_js_test.rb
+++ b/actionpack/test/controller/render_js_test.rb
@@ -19,6 +19,8 @@ class TestController < ActionController::Base
end
class RenderTest < ActionController::TestCase
+ tests TestController
+
def test_render_vanilla_js
get :render_vanilla_js_hello
assert_equal "alert('hello')", @response.body