[rspec-users] URL helpers in model specs

Matt Wynne matt at mattwynne.net
Tue Oct 11 16:03:40 EDT 2011


On 10 Oct 2011, at 18:02, Nick wrote:

> Hey guys. One of my models uses a Rails URL helper. In IRB, the method works. However, when I run the specs for the method, the URL helper doesn't exist.
> 
> The only solution I've found is to include Rails.application.routes.url_helpers in both the model and the example group. Obviously, that's not ideal, because it's only necessary for the specs to work. Is there any other solution?
> 
> https://gist.github.com/1275799

I don't know about anyone else, but I can't see that gist.

cheers,
Matt

--
Freelance programmer & coach
Author, http://pragprog.com/book/hwcuc/the-cucumber-book (with Aslak Hellesøy)
Founder, http://relishapp.com
+44(0)7974430184 | http://twitter.com/mattwynne



More information about the rspec-users mailing list