diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-01 12:03:49 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-01 12:03:49 +0100 |
commit | cbeac93310a7e95453bea3f2d4551288fd455d07 (patch) | |
tree | fed49136581bf2f15b0616139b1e8ff0baed7434 /actionpack/test/controller | |
parent | 408c7227575e0c395a45605783cade1ba3b51e02 (diff) | |
download | rails-cbeac93310a7e95453bea3f2d4551288fd455d07.tar.gz rails-cbeac93310a7e95453bea3f2d4551288fd455d07.tar.bz2 rails-cbeac93310a7e95453bea3f2d4551288fd455d07.zip |
Added render :js for people who want to render inline JavaScript replies without using RJS [DHH]
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index da9702a634..df9376727f 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -184,6 +184,10 @@ class TestController < ActionController::Base render("test/hello") end + def render_vanilla_js_hello + render :js => "alert('hello')" + end + def render_xml_hello @name = "David" render :template => "test/hello" @@ -844,6 +848,12 @@ class RenderTest < Test::Unit::TestCase assert_equal "test", @response.body # name is explicitly set to 'test' inside the controller. end + def test_render_vanilla_js + get :render_vanilla_js_hello + assert_equal "alert('hello')", @response.body + assert_equal "text/javascript", @response.content_type + end + def test_render_xml get :render_xml_hello assert_equal "<html>\n <p>Hello David</p>\n<p>This is grand!</p>\n</html>\n", @response.body |