# Passing object parameters to urls in tests

**URL:** <https://www.ruby-forum.com/t/passing-object-parameters-to-urls-in-tests/153401>\
**Category:** Rails\
**Created:** [November 16, 2008, 2:29pm UTC](https://www.ruby-forum.com/t/passing-object-parameters-to-urls-in-tests/153401 "2008-11-16T14:29:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vahagn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/cc9497/32.png) [@vahagn](https://www.ruby-forum.com/u/vahagn)\
**Post date:** [November 16, 2008, 2:29pm UTC](https://www.ruby-forum.com/t/passing-object-parameters-to-urls-in-tests/153401/1 "2008-11-16T14:29:47Z")

</div>

I am wondering how to pass parameters to route declarations. I have an  
app where one project belongs to a user. In one of my integration tests,  
I want to check that the template being rendered is the one where the  
“logged in user” can register a project:

get new\_user\_project\_path(:user) #does not work  
#assert\_template ‘/users/:id/project/new’ #id must be this user’s id,  
how?  
assert\_template ‘projects/new’ #true, but must be /user/:id/project/new

rake routes says:

POST /users/:user\_id/project  
{:action=\>“create”, :controller=\>“projects”}

new\_user\_project GET /users/:user\_id/project/new  
{:action=\>“new”, :controller=\>“projects”}

Thanks,  
Vahagn
