aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb18
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'