aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/render_test.rb')
-rw-r--r--actionpack/test/controller/render_test.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 2c3dc2a72d..e3c4869391 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -21,6 +21,10 @@ class TestController < ActionController::Base
def hello_world
end
+ def hello_world_file
+ render :file => File.expand_path("../../fixtures/hello.html", __FILE__)
+ end
+
def conditional_hello
if stale?(:last_modified => Time.now.utc.beginning_of_day, :etag => [:foo, 123])
render :action => 'hello_world'
@@ -214,6 +218,10 @@ class TestController < ActionController::Base
render :text => false
end
+ def render_text_with_resource
+ render :text => Customer.new("David")
+ end
+
# :ported:
def render_nothing_with_appendix
render :text => "appended"
@@ -347,7 +355,7 @@ class TestController < ActionController::Base
@before = "i'm before the render"
render_to_string :text => "foo"
@after = "i'm after the render"
- render :action => "test/hello_world"
+ render :template => "test/hello_world"
end
def render_to_string_with_exception
@@ -361,7 +369,7 @@ class TestController < ActionController::Base
rescue
end
@after = "i'm after the render"
- render :action => "test/hello_world"
+ render :template => "test/hello_world"
end
def accessing_params_in_template_with_layout
@@ -506,7 +514,7 @@ class TestController < ActionController::Base
def render_to_string_with_partial
@partial_only = render_to_string :partial => "partial_only"
@partial_with_locals = render_to_string :partial => "customer", :locals => { :customer => Customer.new("david") }
- render :action => "test/hello_world"
+ render :template => "test/hello_world"
end
def partial_with_counter
@@ -747,6 +755,11 @@ class RenderTest < ActionController::TestCase
assert_equal "The secret is in the sauce\n", @response.body
end
+ def test_render_file
+ get :hello_world_file
+ assert_equal "Hello world!", @response.body
+ end
+
# :ported:
def test_render_file_as_string_with_instance_variables
get :render_file_as_string_with_instance_variables
@@ -817,6 +830,11 @@ class RenderTest < ActionController::TestCase
assert_equal 'appended', @response.body
end
+ def test_render_text_with_resource
+ get :render_text_with_resource
+ assert_equal 'name: "David"', @response.body
+ end
+
# :ported:
def test_attempt_to_access_object_method
assert_raise(ActionController::UnknownAction, "No action responded to [clone]") { get :clone }