aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-08-24 16:42:14 -0300
committerJosé Valim <jose.valim@gmail.com>2010-08-24 16:58:25 -0300
commite197d6f34b72cd96ffc5c6680ed8d433f1b1c4db (patch)
tree903346f50be3ec7ef5ade287aca8a1c02e3ec335 /actionpack/test/dispatch/routing_test.rb
parent4a90ecb3adff8426aeddee0594c2b68f408e4af1 (diff)
downloadrails-e197d6f34b72cd96ffc5c6680ed8d433f1b1c4db.tar.gz
rails-e197d6f34b72cd96ffc5c6680ed8d433f1b1c4db.tar.bz2
rails-e197d6f34b72cd96ffc5c6680ed8d433f1b1c4db.zip
Finally fix the bug where symbols and strings were not having the same behavior in the router.
If you were using symbols before for methods like match/get/post/put/delete, it is likely that this commit will break your routes. Everything should behave the same if you are using strings, if not, please open up a ticket.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb44
1 files changed, 38 insertions, 6 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 292cfc2a02..92692fb131 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -40,6 +40,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
get :new, :path => "build"
post :create, :path => "create", :as => ""
put :update
+ get :remove, :action => :destroy, :as => :remove
+ end
+
+ scope "pagemark", :controller => "pagemarks", :as => :pagemark do
+ get "new", :path => "build"
+ post "create", :as => ""
+ put "update"
get "remove", :action => :destroy, :as => :remove
end
@@ -203,11 +210,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
resources :customers do
- get "recent" => "customers#recent", :on => :collection
- get "profile" => "customers#profile", :on => :member
+ get :recent, :on => :collection
+ get "profile", :on => :member
+ get "secret/profile" => "customers#secret", :on => :member
post "preview" => "customers#preview", :as => :another_preview, :on => :new
resource :avatar do
- get "thumbnail(.:format)" => "avatars#thumbnail", :as => :thumbnail, :on => :member
+ get "thumbnail" => "avatars#thumbnail", :as => :thumbnail, :on => :member
end
resources :invoices do
get "outstanding" => "invoices#outstanding", :as => :outstanding, :on => :collection
@@ -648,15 +656,15 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
with_test_routes do
get '/bookmark/build'
assert_equal 'bookmarks#new', @response.body
- assert_equal '/bookmark/build', new_bookmark_path
+ assert_equal '/bookmark/build', bookmark_new_path
post '/bookmark/create'
assert_equal 'bookmarks#create', @response.body
assert_equal '/bookmark/create', bookmark_path
- put '/bookmark'
+ put '/bookmark/update'
assert_equal 'bookmarks#update', @response.body
- assert_equal '/bookmark', update_bookmark_path
+ assert_equal '/bookmark/update', bookmark_update_path
get '/bookmark/remove'
assert_equal 'bookmarks#destroy', @response.body
@@ -664,6 +672,26 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_pagemarks
+ with_test_routes do
+ get '/pagemark/build'
+ assert_equal 'pagemarks#new', @response.body
+ assert_equal '/pagemark/build', pagemark_new_path
+
+ post '/pagemark/create'
+ assert_equal 'pagemarks#create', @response.body
+ assert_equal '/pagemark/create', pagemark_path
+
+ put '/pagemark/update'
+ assert_equal 'pagemarks#update', @response.body
+ assert_equal '/pagemark/update', pagemark_update_path
+
+ get '/pagemark/remove'
+ assert_equal 'pagemarks#destroy', @response.body
+ assert_equal '/pagemark/remove', pagemark_remove_path
+ end
+ end
+
def test_admin
with_test_routes do
get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'}
@@ -1564,6 +1592,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
with_test_routes do
assert_equal '/customers/recent', recent_customers_path
assert_equal '/customers/1/profile', profile_customer_path(:id => '1')
+ assert_equal '/customers/1/secret/profile', secret_profile_customer_path(:id => '1')
assert_equal '/customers/new/preview', another_preview_new_customer_path
assert_equal '/customers/1/avatar/thumbnail.jpg', thumbnail_customer_avatar_path(:customer_id => '1', :format => :jpg)
assert_equal '/customers/1/invoices/outstanding', outstanding_customer_invoices_path(:customer_id => '1')
@@ -1577,6 +1606,9 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
get '/customers/1/invoices/overdue'
assert_equal 'invoices#overdue', @response.body
+
+ get '/customers/1/secret/profile'
+ assert_equal 'customers#secret', @response.body
end
end