aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2009-03-20 16:50:51 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-23 10:23:14 -0700
commitc6123c37030b715d088860ea1ca79060659b0e3c (patch)
tree36da3c375333660c0ff41dcf113dfdf3f82c9bde /actionpack/test
parent81e814adfad6d4bba1af5f70a5a409f6d71f8f6c (diff)
downloadrails-c6123c37030b715d088860ea1ca79060659b0e3c.tar.gz
rails-c6123c37030b715d088860ea1ca79060659b0e3c.tar.bz2
rails-c6123c37030b715d088860ea1ca79060659b0e3c.zip
Finished implementing layout for render :text
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/abstract_controller/abstract_controller_test.rb8
-rw-r--r--actionpack/test/abstract_controller/helper_test.rb4
-rw-r--r--actionpack/test/new_base/render_text_test.rb28
-rw-r--r--actionpack/test/new_base/test_helper.rb2
4 files changed, 37 insertions, 5 deletions
diff --git a/actionpack/test/abstract_controller/abstract_controller_test.rb b/actionpack/test/abstract_controller/abstract_controller_test.rb
index 31c28a5c48..96193fd24c 100644
--- a/actionpack/test/abstract_controller/abstract_controller_test.rb
+++ b/actionpack/test/abstract_controller/abstract_controller_test.rb
@@ -31,7 +31,11 @@ module AbstractController
def _prefix() end
- def render(name = action_name, options = {})
+ def render(options = {})
+ if options.is_a?(String)
+ options = {:_template_name => options}
+ end
+
options[:_prefix] = _prefix
super
end
@@ -130,7 +134,7 @@ module AbstractController
self.class.layout(formats)
end
- def render_to_string(name = action_name, options = {})
+ def render_to_string(options = {})
options[:_layout] = options[:layout] || _layout
super
end
diff --git a/actionpack/test/abstract_controller/helper_test.rb b/actionpack/test/abstract_controller/helper_test.rb
index 81dbee3065..e1b2141331 100644
--- a/actionpack/test/abstract_controller/helper_test.rb
+++ b/actionpack/test/abstract_controller/helper_test.rb
@@ -7,6 +7,10 @@ module AbstractController
include Renderer
include Helpers
+ def render(string)
+ super(:_template_name => string)
+ end
+
append_view_path File.expand_path(File.join(File.dirname(__FILE__), "views"))
end
diff --git a/actionpack/test/new_base/render_text_test.rb b/actionpack/test/new_base/render_text_test.rb
index 61ec6e05df..f91e6bd644 100644
--- a/actionpack/test/new_base/render_text_test.rb
+++ b/actionpack/test/new_base/render_text_test.rb
@@ -8,7 +8,7 @@ module HappyPath
"layouts/greetings.html.erb" => "<%= yield %>, I wish thee well."
)]
- def render_hello_world_from_variable
+ def render_hello_world
render :text => "hello david"
end
@@ -36,6 +36,14 @@ module HappyPath
render :text => "hello world", :layout => true
end
+ def render_text_with_layout_false
+ render :text => "hello world", :layout => false
+ end
+
+ def render_text_with_layout_nil
+ render :text => "hello world", :layout => nil
+ end
+
def render_text_with_custom_layout
render :text => "hello world", :layout => "greetings"
end
@@ -44,7 +52,7 @@ module HappyPath
class TestSimpleTextRender < SimpleRouteCase
describe "Rendering text from a action with default options renders the text without the layout"
- get "/happy_path/render_text/render_hello_world_from_variable"
+ get "/happy_path/render_text/render_hello_world"
assert_body "hello david"
assert_status 200
end
@@ -96,4 +104,20 @@ module HappyPath
assert_body "hello world, I wish thee well."
assert_status 200
end
+
+ class TestTextRenderWithLayoutFalse < SimpleRouteCase
+ describe "Rendering text with :layout => false"
+
+ get "/happy_path/render_text/render_text_with_layout_false"
+ assert_body "hello world"
+ assert_status 200
+ end
+
+ class TestTextRenderWithLayoutNil < SimpleRouteCase
+ describe "Rendering text with :layout => nil"
+
+ get "/happy_path/render_text/render_text_with_layout_nil"
+ assert_body "hello world"
+ assert_status 200
+ end
end \ No newline at end of file
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb
index affb52a432..a66fc321e6 100644
--- a/actionpack/test/new_base/test_helper.rb
+++ b/actionpack/test/new_base/test_helper.rb
@@ -32,8 +32,8 @@ module ActionController
include ActionController::HideActions
include ActionController::UrlFor
- include ActionController::Renderer
include ActionController::Layouts
+ include ActionController::Renderer
def self.inherited(klass)
@subclasses ||= []