Quick Tip: Asserting response redirects in a MonoRail controller test

posted @ Thursday, September 06, 2007 5:34 PM

 

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.

Comments
Sean Chambers - 9/6/2007 8:36 PM
# re: Quick Tip: Asserting response redirects in a MonoRail controller test
The last project I worked on exclusively used BaseControllerTest and it does work very well.

I hope that RC3 gets out the door soon so everyone not on the trunk can benefit!
Post Comment






Please add 8 and 2 and type the answer here: