On Sun, Jan 31, 2010 at 17:02, Nick Hoffman <li...@ruby-forum.com> wrote:
> One of my controller actions sends a redirect if the request URI begins
> with /foods/search
>
>  34  def search
>  35    return redirect_to "/#{params[:name]}" if
> request.request_uri.match /^\/foods\/search/
>
> Unfortunately, I can't figure out how to spec this.

Do you want to check that search redirects, or the algorithm for
computing the redirect path? I would probably check the algorithm
separately, then stub the algorithm to check the redirect.
-- 
J. B. (Joe) Rainsberger :: http://www.jbrains.ca ::
http://blog.thecodewhisperer.com
Diaspar Software Services :: http://www.diasparsoftware.com
Author, JUnit Recipes
2005 Gordon Pask Award for contribution to Agile practice :: Agile
2010: Learn. Practice. Explore.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to