[rspec-users] params are making my "should redirect_to" test fail - why??

Max Williams toastkid.williams at gmail.com
Thu Feb 14 09:15:32 EST 2008


perfect - that's the method i was looking for.  Thanks!

On 14/02/2008, Rick DeNatale <rick.denatale at gmail.com> wrote:
>
> On 2/14/08, Max Williams <toastkid.williams at gmail.com> wrote:
> > Hi David - thanks for replying.  The literal doesn't work either,
> because of
> > all the params at the end, and i don't have named routes in this old,
> > non-restful app.  I see your point about the hash...is there any way to
> get
> > the redirected-to url from 'response' and test against that?  Then i
> could
> > split it at "?" to ignore the params.  (I'd rather not include the
> specific
> > params in this test since i really just want to know about where it's
> > redirected to).
> >
> > So, ideally i could do something like this -
> >
> > response.url.split("?").first.should
> > eql("http://test.host/admin/users/batch_saved")
> >
> >  I've been looking for documentation for methods for the response
> object, to
> > get the url, but i can't find any in the api docs (i'm probably just
> looking
> > in the wrong place).  I can see the url data in the object but it's
> private.
>
>
> Well the RedirectTo matcher gets it using
>
>     response.redirect_url
>
> I'd probably write the check as
>
>    response.should be_redirect
>    response.redirect_url.should
> match(%r{^http://test.host/admin/users/batch_saved(\?|$)})
>
>
> --
> Rick DeNatale
>
> My blog on Ruby
> http://talklikeaduck.denhaven2.com/
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080214/01f70526/attachment-0001.html 


More information about the rspec-users mailing list