# Using \_url helper in unit test

**URL:** <https://www.ruby-forum.com/t/using-url-helper-in-unit-test/175652>\
**Category:** Rails\
**Created:** [September 17, 2009, 4:48am UTC](https://www.ruby-forum.com/t/using-url-helper-in-unit-test/175652 "2009-09-17T04:48:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@drewB](https://www.ruby-forum.com/u/drewB)\
**Post date:** [September 17, 2009, 4:48am UTC](https://www.ruby-forum.com/t/using-url-helper-in-unit-test/175652/1 "2009-09-17T04:48:05Z")

</div>

I have a actionmailer model that send the user a URL to the website  
for account activation. In my unit tests for the model I want to  
ensure that the correct URL is being generated. In the test I have  
the following:

assert sent.body.include? new\_account\_activation\_url(:activation\_code  
=\> user.perishable\_token)

When I run the test, I get undefined method  
‘new\_account\_activation\_url’. ‘new\_account\_activation\_url’ works fine  
in the model so I know it is not a routing problem. I assume that I  
need to include some helper to get this to work but I am not sure what  
to include.

Any ideas?

Thanks!
