aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/new_base')
-rw-r--r--actionpack/test/new_base/render_template_test.rb15
-rw-r--r--actionpack/test/new_base/test_helper.rb5
2 files changed, 19 insertions, 1 deletions
diff --git a/actionpack/test/new_base/render_template_test.rb b/actionpack/test/new_base/render_template_test.rb
index bc52eb019f..63769df082 100644
--- a/actionpack/test/new_base/render_template_test.rb
+++ b/actionpack/test/new_base/render_template_test.rb
@@ -5,7 +5,8 @@ module RenderTemplate
self.view_paths = [ActionView::Template::FixturePath.new(
"test/basic.html.erb" => "Hello from basic.html.erb",
- "shared.html.erb" => "Elastica"
+ "shared.html.erb" => "Elastica",
+ "locals.html.erb" => "The secret is <%= secret %>"
)]
def index
@@ -19,6 +20,10 @@ module RenderTemplate
def in_top_directory_with_slash
render :template => '/shared'
end
+
+ def with_locals
+ render :template => "locals", :locals => { :secret => 'area51' }
+ end
end
class TestWithoutLayout < SimpleRouteCase
@@ -44,6 +49,14 @@ module RenderTemplate
assert_body "Elastica"
assert_status 200
end
+
+ class TestTemplateRenderWithLocals < SimpleRouteCase
+ describe "rendering a template with local variables"
+
+ get "/render_template/without_layout/with_locals"
+ assert_body "The secret is area51"
+ assert_status 200
+ end
class WithLayoutController < ::ApplicationController
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb
index cc79d6faf7..b40cbb163f 100644
--- a/actionpack/test/new_base/test_helper.rb
+++ b/actionpack/test/new_base/test_helper.rb
@@ -58,6 +58,11 @@ module ActionController
end
end
+ def render_to_body(options = {})
+ options = {:template => options} if options.is_a?(String)
+ super
+ end
+
# append_view_path File.join(File.dirname(__FILE__), '..', 'fixtures')
CORE_METHODS = self.public_instance_methods