From 8a4e77b4200946ba4ed42fe5927a7400a846063a Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Mon, 27 Apr 2009 18:21:26 -0700 Subject: OMG, a lot of work --- actionpack/test/new_base/base_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionpack/test/new_base/base_test.rb') diff --git a/actionpack/test/new_base/base_test.rb b/actionpack/test/new_base/base_test.rb index 4f46cb6492..b0e87b4f5b 100644 --- a/actionpack/test/new_base/base_test.rb +++ b/actionpack/test/new_base/base_test.rb @@ -34,11 +34,11 @@ module HappyPath end test "sets the content type" do - assert_content_type Mime::HTML + assert_content_type "text/html; charset=utf-8" end test "sets the content length" do - assert_header "Content-Length", 7 + assert_header "Content-Length", "7" end end @@ -52,7 +52,7 @@ module HappyPath end test "setting the body manually sets the content length" do - assert_header "Content-Length", 7 + assert_header "Content-Length", "7" end end @@ -65,7 +65,7 @@ module HappyPath end test "updating the response body updates the content length" do - assert_header "Content-Length", 8 + assert_header "Content-Length", "8" end end end -- cgit v1.2.3 From 1b459916039259383808625d1758a8bc4a4516d9 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Wed, 29 Apr 2009 11:42:27 -0700 Subject: Renamed the new_base tests --- actionpack/test/new_base/base_test.rb | 43 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'actionpack/test/new_base/base_test.rb') diff --git a/actionpack/test/new_base/base_test.rb b/actionpack/test/new_base/base_test.rb index b0e87b4f5b..95fdfd6b56 100644 --- a/actionpack/test/new_base/base_test.rb +++ b/actionpack/test/new_base/base_test.rb @@ -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 @@ module HappyPath 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 @@ module HappyPath # :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 @@ module HappyPath # :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 @@ module HappyPath 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 \ No newline at end of file -- cgit v1.2.3 From 4f68311685831b940936130203c240fa23525c84 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Wed, 29 Apr 2009 12:19:17 -0700 Subject: Finished implementing render :text in Base2 --- actionpack/test/new_base/base_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/test/new_base/base_test.rb') diff --git a/actionpack/test/new_base/base_test.rb b/actionpack/test/new_base/base_test.rb index 95fdfd6b56..27d1a7f026 100644 --- a/actionpack/test/new_base/base_test.rb +++ b/actionpack/test/new_base/base_test.rb @@ -84,6 +84,6 @@ module Dispatching def test_controller_name assert_equal 'empty', EmptyController.controller_name assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name - end + end end end \ No newline at end of file -- cgit v1.2.3 From e046f36824fcc164c284a13524c6b4153010a4e1 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Fri, 1 May 2009 17:27:44 -0700 Subject: Renamed Base2 to Base and don't require old action_controller for new Base --- actionpack/test/new_base/base_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/test/new_base/base_test.rb') diff --git a/actionpack/test/new_base/base_test.rb b/actionpack/test/new_base/base_test.rb index 27d1a7f026..a32653f128 100644 --- a/actionpack/test/new_base/base_test.rb +++ b/actionpack/test/new_base/base_test.rb @@ -2,7 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") # Tests the controller dispatching happy path module Dispatching - class SimpleController < ActionController::Base2 + class SimpleController < ActionController::Base def index render :text => "success" end @@ -69,9 +69,9 @@ module Dispatching end end - class EmptyController < ActionController::Base2 ; end + class EmptyController < ActionController::Base ; end module Submodule - class ContainedEmptyController < ActionController::Base2 ; end + class ContainedEmptyController < ActionController::Base ; end end class ControllerClassTests < Test::Unit::TestCase -- cgit v1.2.3 From c03b0ca7eb7e73587005e1440bf90cd01ed10aa5 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 20 May 2009 21:15:06 +0200 Subject: Replace the class level Rack::Test DSL with the regular integration tests DSL --- actionpack/test/new_base/base_test.rb | 80 ++++++++++++++--------------------- 1 file changed, 31 insertions(+), 49 deletions(-) (limited to 'actionpack/test/new_base/base_test.rb') 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 -- cgit v1.2.3