aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-11-02 03:52:15 +0530
committerPratik Naik <pratiknaik@gmail.com>2008-11-02 03:52:15 +0530
commit1147453fce0890ea229c3af5f43c909ebe53061e (patch)
tree221d816ef0c908044fd6029950ccad064866ab8f /actionpack/test/controller
parenta3aa0c17ef8594a0084511f4852be7b5dc66e5e2 (diff)
parent5a02f0bccf55191c2cfbcc69bd8165df6d7a2012 (diff)
downloadrails-1147453fce0890ea229c3af5f43c909ebe53061e.tar.gz
rails-1147453fce0890ea229c3af5f43c909ebe53061e.tar.bz2
rails-1147453fce0890ea229c3af5f43c909ebe53061e.zip
Merge commit 'mainstream/master'
Conflicts: railties/doc/guides/html/layouts_and_rendering.html railties/doc/guides/source/active_record_basics.txt railties/doc/guides/source/layouts_and_rendering.txt
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/redirect_test.rb10
-rw-r--r--actionpack/test/controller/render_test.rb20
2 files changed, 30 insertions, 0 deletions
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb
index 2f8bf7b6ee..c55307d645 100644
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -73,6 +73,10 @@ class RedirectController < ActionController::Base
redirect_to "http://dev.rubyonrails.org/query?status=new"
end
+ def redirect_to_url_with_complex_scheme
+ redirect_to "x-test+scheme.complex:redirect"
+ end
+
def redirect_to_back
redirect_to :back
end
@@ -198,6 +202,12 @@ class RedirectTest < Test::Unit::TestCase
assert_redirected_to "http://dev.rubyonrails.org/query?status=new"
end
+ def test_redirect_to_url_with_complex_scheme
+ get :redirect_to_url_with_complex_scheme
+ assert_response :redirect
+ assert_equal "x-test+scheme.complex:redirect", redirect_to_url
+ end
+
def test_redirect_to_back
@request.env["HTTP_REFERER"] = "http://www.example.com/coming/from"
get :redirect_to_back
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index db2d5d885b..df9376727f 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -154,6 +154,10 @@ class TestController < ActionController::Base
render :json => {:hello => 'world'}.to_json
end
+ def render_json_with_render_to_string
+ render :json => {:hello => render_to_string(:partial => 'partial')}
+ end
+
def render_custom_code
render :text => "hello world", :status => 404
end
@@ -180,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"
@@ -772,6 +780,12 @@ class RenderTest < Test::Unit::TestCase
assert_equal 'application/json', @response.content_type
end
+ def test_render_json_with_render_to_string
+ get :render_json_with_render_to_string
+ assert_equal '{"hello": "partial html"}', @response.body
+ assert_equal 'application/json', @response.content_type
+ end
+
def test_render_custom_code
get :render_custom_code
assert_response 404
@@ -834,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