Los Techies : Blogs about software and anything tech!

Quick Tip: Asserting response redirects in a MonoRail controller test


Reading this post by Sean reminded me of when I first started using the trunk's BaseControllerTest.  One nifty little property on the base test controller's mock Response object is RedirectedTo.  So you can do something like this:

   1: // some call on the controller that should do the redirect
   2: Assert.AreEqual("/productSearch/performSearch.rails", Response.RedirectedTo);

In previous MonoRail projects, I used the very nice base class from the guys at Eleutian and it worked great.  But I've been using the trunk's BaseControllerTest exclusively on my current project since it started a few months ago and it rocks as well.  Nice to have it "out of the box" now.

Kick It on DotNetKicks.com
Posted Sep 07 2007, 06:16 PM by joeyDotNet
Filed under: , , ,

Comments

Jason Meridth wrote re: Quick Tip: Asserting response redirects in a MonoRail controller test
on 09-17-2007 6:39 PM

I used this tonight for a future MonoRail validation post.  Thank you Joey.  Little insights like this are vital for us newbies.  We appreciate it.

Copyright Los Techies 2008, 2009. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems