From d48acc329c8c12c033979d52be6c21f80de97647 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 17 Jun 2010 14:27:23 -0700 Subject: [PATCH] [#4177] Nest contract routes under the project. --- config/routes.rb | 2 +- test/integration/routing_test.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/integration/routing_test.rb diff --git a/config/routes.rb b/config/routes.rb index ec8da28..6de19c4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,3 @@ ActionController::Routing::Routes.draw do |map| - map.resources :contracts + map.resources :contracts, :path_prefix => '/projects/:project_id' end diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb new file mode 100644 index 0000000..ef3f472 --- /dev/null +++ b/test/integration/routing_test.rb @@ -0,0 +1,18 @@ +require 'test_helper' + +class RoutingTest < ActionController::IntegrationTest + context "contracts" do + should_route :get, "/projects/world_domination/contracts", :controller => 'contracts', :action => 'index', :project_id => 'world_domination' + should_route :get, "/projects/world_domination/contracts/new", :controller => 'contracts', :action => 'new', :project_id => 'world_domination' + should_route :get, "/projects/world_domination/contracts/1", :controller => 'contracts', :action => 'show', :id => '1', :project_id => 'world_domination' + should_route :get, "/projects/world_domination/contracts/1/edit", :controller => 'contracts', :action => 'edit', :id => '1', :project_id => 'world_domination' + + should_route :post, "/projects/world_domination/contracts", :controller => 'contracts', :action => 'create', :project_id => 'world_domination' + + should_route :put, "/projects/world_domination/contracts/1", :controller => 'contracts', :action => 'update', :id => '1', :project_id => 'world_domination' + + should_route :delete, "/projects/world_domination/contracts/1", :controller => 'contracts', :action => 'destroy', :id => '1', :project_id => 'world_domination' + + end + +end