From 1ae0a53d861c43dff8883fc956a08404c23f180c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 24 Jul 2005 13:20:29 +0000 Subject: Fixed regression for content_for #1820 [Stefan Kaes] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1911 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/capture_test.rb | 9 +++++++++ actionpack/test/fixtures/layouts/talk_from_action.rhtml | 2 +- actionpack/test/fixtures/test/content_for.rhtml | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 actionpack/test/fixtures/test/content_for.rhtml (limited to 'actionpack/test') diff --git a/actionpack/test/controller/capture_test.rb b/actionpack/test/controller/capture_test.rb index a48baaeda1..eab7865937 100644 --- a/actionpack/test/controller/capture_test.rb +++ b/actionpack/test/controller/capture_test.rb @@ -4,6 +4,10 @@ class CaptureController < ActionController::Base def self.controller_name; "test"; end def self.controller_path; "test"; end + def content_for + render :layout => "talk_from_action" + end + def rescue_action(e) raise end end @@ -27,6 +31,11 @@ class CaptureTest < Test::Unit::TestCase get :capturing assert_equal "Dreamy days", @response.body.strip end + + def test_content_for + get :content_for + assert_equal "Putting stuff in the title!\n\nGreat stuff!", @response.body + end def test_update_element_with_capture get :update_element_with_capture diff --git a/actionpack/test/fixtures/layouts/talk_from_action.rhtml b/actionpack/test/fixtures/layouts/talk_from_action.rhtml index 215dfd27ac..187aab07a2 100644 --- a/actionpack/test/fixtures/layouts/talk_from_action.rhtml +++ b/actionpack/test/fixtures/layouts/talk_from_action.rhtml @@ -1,2 +1,2 @@ -<%= @title %> +<%= @title || @content_for_title %> <%= @content_for_layout -%> \ No newline at end of file diff --git a/actionpack/test/fixtures/test/content_for.rhtml b/actionpack/test/fixtures/test/content_for.rhtml new file mode 100644 index 0000000000..0e47ca8c3d --- /dev/null +++ b/actionpack/test/fixtures/test/content_for.rhtml @@ -0,0 +1,2 @@ +<% content_for :title do %>Putting stuff in the title!<% end %> +Great stuff! \ No newline at end of file -- cgit v1.2.3