Permalink
Browse files

Renamed the new_base tests

  • Loading branch information...
Yehuda Katz + Carl Lerche
Yehuda Katz + Carl Lerche committed Apr 29, 2009
1 parent b692fce commit 1b459916039259383808625d1758a8bc4a4516d9
@@ -106,6 +106,7 @@ def render_template_in_top_directory_with_slash
render :template => '/shared'
end
+ # :ported:
def render_hello_world_from_variable
@person = "david"
render :text => "hello #{@person}"
@@ -123,6 +124,7 @@ def render_action_hello_world_with_symbol
render :action => :hello_world
end
+ # :ported:
def render_text_hello_world
render :text => "hello world"
end
@@ -1,8 +1,8 @@
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
# Tests the controller dispatching happy path
-module HappyPath
- class SimpleDispatchController < ActionController::Base2
+module Dispatching
+ class SimpleController < ActionController::Base2
def index
render :text => "success"
end
@@ -23,7 +23,7 @@ def modify_response_headers
class TestSimpleDispatch < SimpleRouteCase
- get "/happy_path/simple_dispatch/index"
+ get "/dispatching/simple/index"
test "sets the body" do
assert_body "success"
@@ -45,7 +45,7 @@ class TestSimpleDispatch < SimpleRouteCase
# :api: plugin
class TestDirectResponseMod < SimpleRouteCase
- get "/happy_path/simple_dispatch/modify_response_body"
+ get "/dispatching/simple/modify_response_body"
test "sets the body" do
assert_body "success"
@@ -58,7 +58,7 @@ class TestDirectResponseMod < SimpleRouteCase
# :api: plugin
class TestDirectResponseModTwice < SimpleRouteCase
- get "/happy_path/simple_dispatch/modify_response_body_twice"
+ get "/dispatching/simple/modify_response_body_twice"
test "self.response_body= returns the body being set" do
assert_body "success!"
@@ -68,23 +68,22 @@ class TestDirectResponseModTwice < SimpleRouteCase
assert_header "Content-Length", "8"
end
end
-end
-
-
-class EmptyController < ActionController::Base2 ; end
-module Submodule
- class ContainedEmptyController < ActionController::Base2 ; end
-end
+
+ class EmptyController < ActionController::Base2 ; end
+ module Submodule
+ class ContainedEmptyController < ActionController::Base2 ; end
+ end
-class ControllerClassTests < Test::Unit::TestCase
- def test_controller_path
- assert_equal 'empty', EmptyController.controller_path
- assert_equal EmptyController.controller_path, EmptyController.new.controller_path
- assert_equal 'submodule/contained_empty', Submodule::ContainedEmptyController.controller_path
- assert_equal Submodule::ContainedEmptyController.controller_path, Submodule::ContainedEmptyController.new.controller_path
+ class ControllerClassTests < Test::Unit::TestCase
+ def test_controller_path
+ assert_equal 'dispatching/empty', EmptyController.controller_path
+ assert_equal EmptyController.controller_path, EmptyController.new.controller_path
+ assert_equal 'dispatching/submodule/contained_empty', Submodule::ContainedEmptyController.controller_path
+ assert_equal Submodule::ContainedEmptyController.controller_path, Submodule::ContainedEmptyController.new.controller_path
+ end
+ def test_controller_name
+ assert_equal 'empty', EmptyController.controller_name
+ assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name
+ end
end
- def test_controller_name
- assert_equal 'empty', EmptyController.controller_name
- assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name
- end
end
@@ -1,52 +1,51 @@
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
-module HappyPath
-
- class RenderTemplateWithoutLayoutController < ActionController::Base2
+module RenderTemplate
+ class WithoutLayoutController < ActionController::Base2
self.view_paths = [ActionView::Template::FixturePath.new(
"test/basic.html.erb" => "Hello from basic.html.erb",
"shared.html.erb" => "Elastica"
)]
- def render_hello_world
+ def index
render :template => "test/basic"
end
- def render_template_in_top_directory
+ def in_top_directory
render :template => 'shared'
end
- def render_template_in_top_directory_with_slash
+ def in_top_directory_with_slash
render :template => '/shared'
end
end
- class TestTemplateRenderWithoutLayout < SimpleRouteCase
+ class TestWithoutLayout < SimpleRouteCase
describe "rendering a normal template with full path without layout"
- get "/happy_path/render_template_without_layout/render_hello_world"
+ get "/render_template/without_layout"
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_without_layout/render_template_in_top_directory"
+ get "/render_template/without_layout/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_without_layout/render_template_in_top_directory_with_slash"
+ get "/render_template/without_layout/in_top_directory_with_slash"
assert_body "Elastica"
assert_status 200
end
- class RenderTemplateWithLayoutController < ::ApplicationController
+ class WithLayoutController < ::ApplicationController
self.view_paths = [ActionView::Template::FixturePath.new(
"test/basic.html.erb" => "Hello from basic.html.erb",
@@ -55,86 +54,85 @@ class RenderTemplateWithLayoutController < ::ApplicationController
"layouts/greetings.html.erb" => "<%= yield %>, I wish thee well."
)]
- def render_hello_world
+ def index
render :template => "test/basic"
end
- def render_hello_world_with_layout
+ def with_layout
render :template => "test/basic", :layout => true
end
- def render_hello_world_with_layout_false
+ def with_layout_false
render :template => "test/basic", :layout => false
end
- def render_hello_world_with_layout_nil
+ def with_layout_nil
render :template => "test/basic", :layout => nil
end
- def render_hello_world_with_custom_layout
+ def with_custom_layout
render :template => "test/basic", :layout => "greetings"
end
end
class TestTemplateRenderWithLayout < SimpleRouteCase
describe "rendering a normal template with full path with layout"
- get "/happy_path/render_template_with_layout/render_hello_world"
+ get "/render_template/with_layout"
assert_body "Hello from basic.html.erb, I'm here!"
assert_status 200
end
class TestTemplateRenderWithLayoutTrue < SimpleRouteCase
describe "rendering a normal template with full path with layout => :true"
- get "/happy_path/render_template_with_layout/render_hello_world_with_layout"
+ get "/render_template/with_layout/with_layout"
assert_body "Hello from basic.html.erb, I'm here!"
assert_status 200
end
class TestTemplateRenderWithLayoutFalse < SimpleRouteCase
describe "rendering a normal template with full path with layout => :false"
- get "/happy_path/render_template_with_layout/render_hello_world_with_layout_false"
+ get "/render_template/with_layout/with_layout_false"
assert_body "Hello from basic.html.erb"
assert_status 200
end
class TestTemplateRenderWithLayoutNil < SimpleRouteCase
describe "rendering a normal template with full path with layout => :nil"
- get "/happy_path/render_template_with_layout/render_hello_world_with_layout_nil"
+ get "/render_template/with_layout/with_layout_nil"
assert_body "Hello from basic.html.erb"
assert_status 200
end
class TestTemplateRenderWithCustomLayout < SimpleRouteCase
describe "rendering a normal template with full path with layout => 'greetings'"
- get "/happy_path/render_template_with_layout/render_hello_world_with_custom_layout"
+ get "/render_template/with_layout/with_custom_layout"
assert_body "Hello from basic.html.erb, I wish thee well."
assert_status 200
end
+
+ module Compatibility
+ class WithoutLayoutController < ActionController::CompatibleBase2
+ self.view_paths = [ActionView::Template::FixturePath.new(
+ "test/basic.html.erb" => "Hello from basic.html.erb",
+ "shared.html.erb" => "Elastica"
+ )]
-end
+ def with_forward_slash
+ render :template => "/test/basic"
+ end
+ end
-module Compatibility
- class RenderTemplateWithoutLayoutController < ActionController::CompatibleBase2
- self.view_paths = [ActionView::Template::FixturePath.new(
- "test/basic.html.erb" => "Hello from basic.html.erb",
- "shared.html.erb" => "Elastica"
- )]
-
- def render_hello_world_with_forward_slash
- render :template => "/test/basic"
+ class TestTemplateRenderWithForwardSlash < SimpleRouteCase
+ describe "rendering a normal template with full path starting with a leading slash"
+
+ get "/render_template/compatibility/without_layout/with_forward_slash"
+ assert_body "Hello from basic.html.erb"
+ assert_status 200
end
end
-
- class TestTemplateRenderWithForwardSlash < SimpleRouteCase
- describe "rendering a normal template with full path starting with a leading slash"
-
- get "/compatibility/render_template_without_layout/render_hello_world_with_forward_slash"
- assert_body "Hello from basic.html.erb"
- assert_status 200
- end
end
Oops, something went wrong.

0 comments on commit 1b45991

Please sign in to comment.