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.