# \[PATCH\] Need help to write a test

**URL:** <https://www.ruby-forum.com/t/patch-need-help-to-write-a-test/108465>\
**Category:** Rails\
**Created:** [July 3, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/patch-need-help-to-write-a-test/108465 "2007-07-03T21:03:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kayros](https://www.ruby-forum.com/u/kayros)\
**Post date:** [July 3, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/patch-need-help-to-write-a-test/108465/1 "2007-07-03T21:03:15Z")

</div>

I’m trying to write a test for a modification I’ve done on link\_to  
helper. The problem is that my patch is relying on url\_for behaviour  
defined in link\_to helper.

In url\_helper\_test.rb test file url\_for is overwrited for testing  
convinience.

So my question is how can I do to test my modification using the real  
url\_for method (the one in url\_helper.rb). Is there a way to load it  
from the inside of my test or something like this?

## Thank you in advance.

Nicolas C.

> **[Bounga’s Home](https://www.bounga.org/)**
>
> Thoughts about Ruby, Rails, Hanami, Elixir, Phoenix, Javascript and Unix.

> **[Nicolas Cavigneaux Resume](https://www.cavigneaux.net/)**
>
> Nicolas Cavigneaux Resume

---

<div class="post-metadata">

**Author:** ![kayros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kayros](https://www.ruby-forum.com/u/kayros)\
**Post date:** [July 3, 2007, 10:01pm UTC](https://www.ruby-forum.com/t/patch-need-help-to-write-a-test/108465/2 "2007-07-03T22:01:23Z")

</div>

Check actionpack/test/template/url\_helper\_test.rb

Thanks,  
Pratik

On 7/3/07, Nicolas C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> from the inside of my test or something like this?
> 
> >

–  
[http://m.onkey.org](http://m.onkey.org)

---

<div class="post-metadata">

**Author:** ![kayros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kayros](https://www.ruby-forum.com/u/kayros)\
**Post date:** [July 4, 2007, 10:19am UTC](https://www.ruby-forum.com/t/patch-need-help-to-write-a-test/108465/3 "2007-07-04T10:19:31Z")

</div>

Le 3 juil. 07 à 21:59, Pratik a écrit :

> Check actionpack/test/template/url\_helper\_test.rb

That’s the file in which I’m trying to write my test.

My question was : is it possible in my test method (in actionpack/  
test/template/url\_helper\_test.rb) to use the real url\_for()  
implementation (the one in url\_helper.rb file) rather than the one  
implemented (for the sake of testing) in the test file.

I need to rely on the behaviour of url\_for method implemented in  
actionpack/lib/actionview/helpers/url\_helper.rb. My modification  
can’t be tested without the original url\_for implementation.

## Any idea ?

Nicolas C.

> **[Bounga’s Home](https://www.bounga.org)**
>
> Thoughts about Ruby, Rails, Hanami, Elixir, Phoenix, Javascript and Unix.

> **[Nicolas Cavigneaux Resume](https://www.cavigneaux.net/)**
>
> Nicolas Cavigneaux Resume
