[rspec-users] resource urls only work *after* a get() in controller spec

Ben Mabey ben at benmabey.com
Sat Jan 31 20:41:56 EST 2009


r_j_h_box-sf at yahoo.com wrote:
> I'm encountering an interesting symptom during example execution.  I'm
> making a shared example group that dries up belongs-to-me before_filter
> testing, and it makes a callback to the example group that says
> it_should_behave_like that.  The callback tells the shared example
> where to expect a redirect for failure.
>
> It seems that prior to
> executing a get() (etc), the resource-based url functions aren't
> accessible.  Following the get(), topics_url works fine.  But before
> then, it gives an error like this:
>
> http://pastie.org/376096
>
> Is
> this a known issue?  Is there a workaround I can use? 
>   
For a workaround try doing a "include ActionController::UrlWriter" in 
your shared example group.

-Ben


More information about the rspec-users mailing list