# Testing get :new

**URL:** <https://www.ruby-forum.com/t/testing-get-new/181025>\
**Category:** Rails\
**Created:** [January 4, 2010, 2:46am UTC](https://www.ruby-forum.com/t/testing-get-new/181025 "2010-01-04T02:46:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [January 4, 2010, 2:46am UTC](https://www.ruby-forum.com/t/testing-get-new/181025/1 "2010-01-04T02:46:59Z")

</div>

I have a RESTful :new method to present a form. I have implemented  
this new method to use a params value params[:site\_id]. For example,  
the URL to this form would be :  
[http://localhost:3000/reviews/new?site\_id=1005](http://localhost:3000/reviews/new?site_id=1005)  
Now I need to test this new method. How do I put in the params value  
in the test? The following line does not seem to do the work.

get :new, :site\_id =\> 1005

thanks.

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [January 4, 2010, 3:40am UTC](https://www.ruby-forum.com/t/testing-get-new/181025/2 "2010-01-04T03:40:14Z")

</div>

maybe it is expecting this??

{:review =\> {:site\_id =\> 10000000000000005}}

On Sun, Jan 3, 2010 at 6:45 PM, Vincent P [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –
> 
> You received this message because you are subscribed to the Google G. “Ruby on Rails: Talk” group.  
> To post to this group, send email to removed\_email\_address@domain.invalid.  
> To unsubscribe from this group, send email to removed\_email\_address@domain.invalid.  
> For more options, visit this group at [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [January 5, 2010, 2:38am UTC](https://www.ruby-forum.com/t/testing-get-new/181025/3 "2010-01-05T02:38:03Z")

</div>

Sorry everyone. Wrong diagnostic.

get :new, :site\_id =\> 1005

is the correct way to pass params to “get.” I just messed up my  
fixtures. That’s all.

On Jan 4, 2:16 am, Colin L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> What do you mean by ‘it does not work’? Do you mean the test does not  
> work or the id does not appear in the params? What is shown in  
> test.log for that request? Using ruby-debug or similar what is in  
> params for that request?
> 
> Colin

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [January 7, 2010, 12:39am UTC](https://www.ruby-forum.com/t/testing-get-new/181025/4 "2010-01-07T00:39:44Z")

</div>

Thanks to your help, I knew I needed to look somewhere else for the  
problem. Thanks.

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [January 4, 2010, 11:17am UTC](https://www.ruby-forum.com/t/testing-get-new/181025/5 "2010-01-04T11:17:57Z")

</div>

2010/1/4 Vincent P [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have a RESTful :new method to present a form. I have implemented  
> this new method to use a params value params[:site\_id]. For example,  
> the URL to this form would be : [http://localhost:3000/reviews/new?site\_id=1005](http://localhost:3000/reviews/new?site_id=1005)  
> Now I need to test this new method. How do I put in the params value  
> in the test? The following line does not seem to do the work.
> 
> get :new, :site\_id =\> 1005

What do you mean by ‘it does not work’? Do you mean the test does not  
work or the id does not appear in the params? What is shown in  
test.log for that request? Using ruby-debug or similar what is in  
params for that request?

Colin

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).
