aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-06-30 12:34:15 +0200
committerJosé Valim <jose.valim@gmail.com>2010-06-30 12:34:15 +0200
commit06681af518036dcc84f4565b59a0dee460b01108 (patch)
treefbe6893b7c766f8100866461f5c96fd06edc9253 /actionpack/test/dispatch/routing_test.rb
parentccbb3bb3d87a48c8763a8afff4c9b21a9bf2539e (diff)
downloadrails-06681af518036dcc84f4565b59a0dee460b01108.tar.gz
rails-06681af518036dcc84f4565b59a0dee460b01108.tar.bz2
rails-06681af518036dcc84f4565b59a0dee460b01108.zip
A couple enhancements to the router:
* Allow to use the get :symbol shortcut outside resources scopes as well; * Fix a bug where :action was not being picked from given options; * Giving :as option inside a resource now changes just the relative name instead of the full name;
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index b5653a391a..26bd641cd6 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -35,6 +35,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ scope "bookmark", :controller => "bookmarks", :as => :bookmark do
+ get :new, :path => "build"
+ post :create, :path => "create", :as => ""
+ put :update
+ get "remove", :action => :destroy, :as => :remove
+ end
+
match 'account/logout' => redirect("/logout"), :as => :logout_redirect
match 'account/login', :to => redirect("/login")
@@ -545,6 +552,26 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_bookmarks
+ with_test_routes do
+ get '/bookmark/build'
+ assert_equal 'bookmarks#new', @response.body
+ assert_equal '/bookmark/build', new_bookmark_path
+
+ post '/bookmark/create'
+ assert_equal 'bookmarks#create', @response.body
+ assert_equal '/bookmark/create', bookmark_path
+
+ put '/bookmark'
+ assert_equal 'bookmarks#update', @response.body
+ assert_equal '/bookmark', update_bookmark_path
+
+ get '/bookmark/remove'
+ assert_equal 'bookmarks#destroy', @response.body
+ assert_equal '/bookmark/remove', bookmark_remove_path
+ end
+ end
+
def test_admin
with_test_routes do
get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'}