diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-13 17:23:14 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-13 17:23:14 -0600 |
commit | d01716731bd9c68de686d6ac85e3da5251305495 (patch) | |
tree | f08f308b1f5b86541abacc430a0e65e833fb8c31 /actionpack/test | |
parent | 5d787590f25a592b85032f951fa5a3441b89eb1b (diff) | |
download | rails-d01716731bd9c68de686d6ac85e3da5251305495.tar.gz rails-d01716731bd9c68de686d6ac85e3da5251305495.tar.bz2 rails-d01716731bd9c68de686d6ac85e3da5251305495.zip |
Add router support for resources :only and :except actions
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index b0d4e34345..6a25deb40c 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -93,6 +93,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + resources :posts, :only => [:index, :show] + match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp match 'people/:id/update', :to => 'people#update', :as => :update_person @@ -421,6 +423,22 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_posts + with_test_routes do + get '/posts' + assert_equal 'posts#index', @response.body + assert_equal '/posts', posts_path + + get '/posts/1' + assert_equal 'posts#show', @response.body + assert_equal '/posts/1', post_path(:id => 1) + + assert_raise(ActionController::RoutingError) { post '/posts' } + assert_raise(ActionController::RoutingError) { put '/posts/1' } + assert_raise(ActionController::RoutingError) { delete '/posts/1' } + end + end + def test_sprockets with_test_routes do get '/sprockets.js' |