From d01716731bd9c68de686d6ac85e3da5251305495 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 13 Jan 2010 17:23:14 -0600 Subject: Add router support for resources :only and :except actions --- actionpack/test/dispatch/routing_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'actionpack/test') 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' -- cgit v1.2.3