aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-03-19 13:35:39 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-19 13:35:39 -0700
commit8ab37c76608d7105c47566e79b85fcf72cb11e4b (patch)
tree590cac61655bdb00d2df7015b515bc125e4c8b10 /actionpack/test
parente0447023db7152d3ecdf693bd9aa36c7daa02653 (diff)
downloadrails-8ab37c76608d7105c47566e79b85fcf72cb11e4b.tar.gz
rails-8ab37c76608d7105c47566e79b85fcf72cb11e4b.tar.bz2
rails-8ab37c76608d7105c47566e79b85fcf72cb11e4b.zip
Started implementing render :action
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/fixtures/happy_path/render_action/hello_world.erb1
-rw-r--r--actionpack/test/new_base/render_action_test.rb75
-rw-r--r--actionpack/test/new_base/render_implicit_action_test.rb16
-rw-r--r--actionpack/test/new_base/render_template_test.rb56
-rw-r--r--actionpack/test/new_base/render_text_test.rb (renamed from actionpack/test/new_base/render_test.rb)53
5 files changed, 148 insertions, 53 deletions
diff --git a/actionpack/test/fixtures/happy_path/render_action/hello_world.erb b/actionpack/test/fixtures/happy_path/render_action/hello_world.erb
new file mode 100644
index 0000000000..6769dd60bd
--- /dev/null
+++ b/actionpack/test/fixtures/happy_path/render_action/hello_world.erb
@@ -0,0 +1 @@
+Hello world! \ No newline at end of file
diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb
new file mode 100644
index 0000000000..b6e98f82aa
--- /dev/null
+++ b/actionpack/test/new_base/render_action_test.rb
@@ -0,0 +1,75 @@
+require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
+
+module HappyPath
+
+ class RenderActionController < ActionController::Base2
+
+ def render_action_hello_world
+ render :action => "hello_world"
+ end
+
+ def render_action_hello_world_as_string
+ render "hello_world"
+ end
+
+ def render_action_hello_world_as_string_with_options
+ render "hello_world", :status => 404
+ end
+
+ def render_action_hello_world_as_symbol
+ render :hello_world
+ end
+
+ def render_action_hello_world_with_symbol
+ render :action => :hello_world
+ end
+
+ end
+
+ class TestRenderAction < SimpleRouteCase
+
+ describe "Rendering an action using :action => <String>"
+
+ get "/happy_path/render_action/render_action_hello_world"
+ assert_body "Hello world!"
+ assert_status 200
+
+ end
+
+ class TestRenderActionWithString < SimpleRouteCase
+
+ describe "Render an action using 'hello_world'"
+
+ get "/happy_path/render_action/render_action_hello_world_as_string"
+ assert_body "Hello world!"
+ assert_status 200
+
+ end
+
+ class TestRenderActionWithStringAndOptions < SimpleRouteCase
+
+ describe "Render an action using 'hello_world'"
+
+ get "/happy_path/render_action/render_action_hello_world_as_string_with_options"
+ assert_body "Hello world!"
+ assert_status 404
+
+ end
+
+ class TestRenderActionAsSymbol < SimpleRouteCase
+ describe "Render an action using :hello_world"
+
+ get "/happy_path/render_action/render_action_hello_world_as_symbol"
+ assert_body "Hello world!"
+ assert_status 200
+ end
+
+ class TestRenderActionWithSymbol < SimpleRouteCase
+ describe "Render an action using :action => :hello_world"
+
+ get "/happy_path/render_action/render_action_hello_world_with_symbol"
+ assert_body "Hello world!"
+ assert_status 200
+ end
+
+end \ No newline at end of file
diff --git a/actionpack/test/new_base/render_implicit_action_test.rb b/actionpack/test/new_base/render_implicit_action_test.rb
new file mode 100644
index 0000000000..798505b539
--- /dev/null
+++ b/actionpack/test/new_base/render_implicit_action_test.rb
@@ -0,0 +1,16 @@
+require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
+
+module HappyPath
+
+ class RenderImplicitActionController < ActionController::Base2
+ # No actions yet, they are implicit
+ end
+
+ class TestRendersActionImplicitly < SimpleRouteCase
+
+ test "renders action implicitly" do
+ assert true
+ end
+
+ end
+end \ No newline at end of file
diff --git a/actionpack/test/new_base/render_template_test.rb b/actionpack/test/new_base/render_template_test.rb
new file mode 100644
index 0000000000..758a206dbb
--- /dev/null
+++ b/actionpack/test/new_base/render_template_test.rb
@@ -0,0 +1,56 @@
+require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
+
+module HappyPath
+
+ class RenderTemplateController < ActionController::Base2
+
+ def render_hello_world
+ render :template => "test/basic"
+ end
+
+ def render_hello_world_with_forward_slash
+ render :template => "/test/basic"
+ end
+
+ def render_template_in_top_directory
+ render :template => 'shared'
+ end
+
+ def render_template_in_top_directory_with_slash
+ render :template => '/shared'
+ end
+ end
+
+ class TestTemplateRender < SimpleRouteCase
+ describe "rendering a normal template with full path"
+
+ get "/happy_path/render_template/render_hello_world"
+ assert_body "Hello from basic.html.erb"
+ assert_status 200
+ end
+
+ class TestTemplateRenderWithForwardSlash < SimpleRouteCase
+ describe "rendering a normal template with full path starting with a leading slash"
+
+ get "/happy_path/render_template/render_hello_world_with_forward_slash"
+ assert_body "Hello from basic.html.erb"
+ assert_status 200
+ end
+
+ class TestTemplateRenderInTopDirectory < SimpleRouteCase
+ describe "rendering a template not in a subdirectory"
+
+ get "/happy_path/render_template/render_template_in_top_directory"
+ assert_body "Elastica"
+ assert_status 200
+ end
+
+ class TestTemplateRenderInTopDirectoryWithSlash < SimpleRouteCase
+ describe "rendering a template not in a subdirectory with a leading slash"
+
+ get "/happy_path/render_template/render_template_in_top_directory_with_slash"
+ assert_body "Elastica"
+ assert_status 200
+ end
+
+end \ No newline at end of file
diff --git a/actionpack/test/new_base/render_test.rb b/actionpack/test/new_base/render_text_test.rb
index 2f43bc1fc6..f845b4c9cc 100644
--- a/actionpack/test/new_base/render_test.rb
+++ b/actionpack/test/new_base/render_text_test.rb
@@ -68,57 +68,4 @@ module HappyPath
assert_body "false"
assert_status 200
end
-
- class RenderTemplateController < ActionController::Base2
-
- def render_hello_world
- render :template => "test/basic"
- end
-
- def render_hello_world_with_forward_slash
- render :template => "/test/basic"
- end
-
- def render_template_in_top_directory
- render :template => 'shared'
- end
-
- def render_template_in_top_directory_with_slash
- render :template => '/shared'
- end
- end
-
- class TestTemplateRender < SimpleRouteCase
- describe "rendering a normal template with full path"
-
- get "/happy_path/render_template/render_hello_world"
- assert_body "Hello from basic.html.erb"
- assert_status 200
- end
-
- class TestTemplateRenderWithForwardSlash < SimpleRouteCase
- describe "rendering a normal template with full path starting with a leading slash"
-
- get "/happy_path/render_template/render_hello_world_with_forward_slash"
- assert_body "Hello from basic.html.erb"
- assert_status 200
- end
-
- class TestTemplateRenderInTopDirectory < SimpleRouteCase
- describe "rendering a template not in a subdirectory"
-
- get "/happy_path/render_template/render_template_in_top_directory"
- assert_body "Elastica"
- assert_status 200
- end
-
- class TestTemplateRenderInTopDirectoryWithSlash < SimpleRouteCase
- describe "rendering a template not in a subdirectory with a leading slash"
-
- get "/happy_path/render_template/render_template_in_top_directory_with_slash"
- assert_body "Elastica"
- assert_status 200
- end
-
- # TODO: Other language craziness
end \ No newline at end of file