aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2009-12-21 11:28:16 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-12-21 11:28:16 -0800
commitfa8849a573aa98750fc5fdacf557d973b85072ca (patch)
tree0c343cdc94eb861413b3f70b1ecf329468dce684 /actionpack/test
parentc06aff0a7e42868e9788d6cefe5ce49e93cbf45b (diff)
parentf09ad263cabe2e781c1994b85375fee8deba4317 (diff)
downloadrails-fa8849a573aa98750fc5fdacf557d973b85072ca.tar.gz
rails-fa8849a573aa98750fc5fdacf557d973b85072ca.tar.bz2
rails-fa8849a573aa98750fc5fdacf557d973b85072ca.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/abstract/abstract_controller_test.rb2
-rw-r--r--actionpack/test/abstract/helper_test.rb2
-rw-r--r--actionpack/test/abstract/layouts_test.rb2
-rw-r--r--actionpack/test/abstract/localized_cache_test.rb2
-rw-r--r--actionpack/test/abstract/render_test.rb2
-rw-r--r--actionpack/test/dispatch/routing_test.rb37
6 files changed, 39 insertions, 8 deletions
diff --git a/actionpack/test/abstract/abstract_controller_test.rb b/actionpack/test/abstract/abstract_controller_test.rb
index 524381509d..4ad87d9762 100644
--- a/actionpack/test/abstract/abstract_controller_test.rb
+++ b/actionpack/test/abstract/abstract_controller_test.rb
@@ -28,7 +28,7 @@ module AbstractController
# Test Render mixin
# ====
class RenderingController < AbstractController::Base
- include ::AbstractController::RenderingController
+ include ::AbstractController::Rendering
def _prefix() end
diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb
index efcd68e5c8..ade29140ba 100644
--- a/actionpack/test/abstract/helper_test.rb
+++ b/actionpack/test/abstract/helper_test.rb
@@ -6,7 +6,7 @@ module AbstractController
module Testing
class ControllerWithHelpers < AbstractController::Base
- include AbstractController::RenderingController
+ include AbstractController::Rendering
include Helpers
def with_module
diff --git a/actionpack/test/abstract/layouts_test.rb b/actionpack/test/abstract/layouts_test.rb
index 5028c19b80..df73d948f0 100644
--- a/actionpack/test/abstract/layouts_test.rb
+++ b/actionpack/test/abstract/layouts_test.rb
@@ -6,7 +6,7 @@ module AbstractControllerTests
# Base controller for these tests
class Base < AbstractController::Base
- include AbstractController::RenderingController
+ include AbstractController::Rendering
include AbstractController::Layouts
self.view_paths = [ActionView::FixtureResolver.new(
diff --git a/actionpack/test/abstract/localized_cache_test.rb b/actionpack/test/abstract/localized_cache_test.rb
index 6f9bb693f7..8b0b0fff03 100644
--- a/actionpack/test/abstract/localized_cache_test.rb
+++ b/actionpack/test/abstract/localized_cache_test.rb
@@ -4,7 +4,7 @@ module AbstractController
module Testing
class CachedController < AbstractController::Base
- include AbstractController::RenderingController
+ include AbstractController::Rendering
include AbstractController::LocalizedCache
self.view_paths = [ActionView::FixtureResolver.new(
diff --git a/actionpack/test/abstract/render_test.rb b/actionpack/test/abstract/render_test.rb
index 331cb6f769..be0478b638 100644
--- a/actionpack/test/abstract/render_test.rb
+++ b/actionpack/test/abstract/render_test.rb
@@ -4,7 +4,7 @@ module AbstractController
module Testing
class ControllerRenderer < AbstractController::Base
- include AbstractController::RenderingController
+ include AbstractController::Rendering
self.view_paths = [ActionView::FixtureResolver.new(
"default.erb" => "With Default",
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 425796b460..7058bc2ea0 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -22,8 +22,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
delete 'logout', :to => :destroy, :as => :logout
end
+ match 'account/logout' => redirect("/logout")
match 'account/login', :to => redirect("/login")
+ match 'account/modulo/:name', :to => redirect("/%{name}s")
+ match 'account/proc/:name', :to => redirect {|params| "/#{params[:name].pluralize}" }
+
match 'openid/login', :via => [:get, :post], :to => "openid#login"
controller(:global) do
@@ -34,11 +38,11 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
constraints(:ip => /192\.168\.1\.\d\d\d/) do
- get 'admin', :to => "queenbee#index"
+ get 'admin' => "queenbee#index"
end
constraints ::TestRoutingMapper::IpRestrictor do
- get 'admin/accounts', :to => "queenbee#accounts"
+ get 'admin/accounts' => "queenbee#accounts"
end
resources :projects, :controller => :project do
@@ -82,7 +86,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- match 'sprockets.js', :to => ::TestRoutingMapper::SprocketsApp
+ match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp
match 'people/:id/update', :to => 'people#update', :as => :update_person
match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person
@@ -145,6 +149,33 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_logout_redirect_without_to
+ with_test_routes do
+ get '/account/logout'
+ assert_equal 301, @response.status
+ assert_equal 'http://www.example.com/logout', @response.headers['Location']
+ assert_equal 'Moved Permanently', @response.body
+ end
+ end
+
+ def test_redirect_modulo
+ with_test_routes do
+ get '/account/modulo/name'
+ assert_equal 301, @response.status
+ assert_equal 'http://www.example.com/names', @response.headers['Location']
+ assert_equal 'Moved Permanently', @response.body
+ end
+ end
+
+ def test_redirect_proc
+ with_test_routes do
+ get '/account/proc/person'
+ assert_equal 301, @response.status
+ assert_equal 'http://www.example.com/people', @response.headers['Location']
+ assert_equal 'Moved Permanently', @response.body
+ end
+ end
+
def test_openid
with_test_routes do
get '/openid/login'