aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/base_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/new_base/base_test.rb')
-rw-r--r--actionpack/test/new_base/base_test.rb80
1 files changed, 31 insertions, 49 deletions
diff --git a/actionpack/test/new_base/base_test.rb b/actionpack/test/new_base/base_test.rb
index a32653f128..d9d552f9e5 100644
--- a/actionpack/test/new_base/base_test.rb
+++ b/actionpack/test/new_base/base_test.rb
@@ -10,78 +10,60 @@ module Dispatching
def modify_response_body
self.response_body = "success"
end
-
+
def modify_response_body_twice
ret = (self.response_body = "success")
self.response_body = "#{ret}!"
end
-
+
def modify_response_headers
-
end
end
-
- class TestSimpleDispatch < SimpleRouteCase
-
- get "/dispatching/simple/index"
-
- test "sets the body" do
+
+ class EmptyController < ActionController::Base ; end
+
+ module Submodule
+ class ContainedEmptyController < ActionController::Base ; end
+ end
+
+ class BaseTest < SimpleRouteCase
+ # :api: plugin
+ test "simple dispatching" do
+ get "/dispatching/simple/index"
+
assert_body "success"
- end
-
- test "sets the status code" do
assert_status 200
- end
-
- test "sets the content type" do
assert_content_type "text/html; charset=utf-8"
- end
-
- test "sets the content length" do
assert_header "Content-Length", "7"
end
-
- end
-
- # :api: plugin
- class TestDirectResponseMod < SimpleRouteCase
- get "/dispatching/simple/modify_response_body"
-
- test "sets the body" do
+
+ # :api: plugin
+ test "directly modifying response body" do
+ get "/dispatching/simple/modify_response_body"
+
assert_body "success"
+ assert_header "Content-Length", "7" # setting the body manually sets the content length
end
-
- test "setting the body manually sets the content length" do
- assert_header "Content-Length", "7"
- end
- end
-
- # :api: plugin
- class TestDirectResponseModTwice < SimpleRouteCase
- get "/dispatching/simple/modify_response_body_twice"
-
- test "self.response_body= returns the body being set" do
+
+ # :api: plugin
+ test "directly modifying response body twice" do
+ get "/dispatching/simple/modify_response_body_twice"
+
assert_body "success!"
- end
-
- test "updating the response body updates the content length" do
assert_header "Content-Length", "8"
end
- end
-
- class EmptyController < ActionController::Base ; end
- module Submodule
- class ContainedEmptyController < ActionController::Base ; end
- end
- class ControllerClassTests < Test::Unit::TestCase
- def test_controller_path
+ test "controller path" do
assert_equal 'dispatching/empty', EmptyController.controller_path
assert_equal EmptyController.controller_path, EmptyController.new.controller_path
+ end
+
+ test "namespaced controller path" do
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
+
+ test "controller name" do
assert_equal 'empty', EmptyController.controller_name
assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name
end