diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-04-29 16:33:24 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-01 17:31:01 -0700 |
commit | 0c3d9bc4c2b329cb754bfed1e465f99d058e1193 (patch) | |
tree | 1ef1697cfe82c714549e4367a3ce63e928a4e04e /actionpack/test/new_base | |
parent | 4f68311685831b940936130203c240fa23525c84 (diff) | |
download | rails-0c3d9bc4c2b329cb754bfed1e465f99d058e1193.tar.gz rails-0c3d9bc4c2b329cb754bfed1e465f99d058e1193.tar.bz2 rails-0c3d9bc4c2b329cb754bfed1e465f99d058e1193.zip |
Ported over render :template tests
Diffstat (limited to 'actionpack/test/new_base')
-rw-r--r-- | actionpack/test/new_base/render_template_test.rb | 15 | ||||
-rw-r--r-- | actionpack/test/new_base/test_helper.rb | 5 |
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 |