New versions of both SpecsFor.Web.Helpers and SpecsFor.Mvc rolled out this week, thanks to the contributions of two users from the community.
[more]
First, Dan Patterson was kind enough to improve the Fake* objects, making it possible to simulate AJAX requests. He added two new interfaces that can be used for configuring the behavior of the fake objects: IHeaderParamsProvider, and IServerParamsProvider. You can find these improvements in the 1.6.0 release.
public class when_posting_to_index_through_ajax : SpecsFor<IsAjaxRequestController> { private ActionResult _result; protected override void Given() { this.FakeAjaxRequest(); } protected override void When() { _result = SUT.Index(It.IsAny<string>()); } [Test] public void then_result_is_JsonResult() { _result.ShouldBeType(typeof(JsonResult)); } }
Next, Markus Neuhoff made a big contribution to SpecsFor.Mvc: you can now enable and test with SSL! You still have to configure the port you want to use for SSL first, but after that, all you have to do is use the fluent API to configure things. This change is available in SpecsFor.Mvc 4.6.0.
var config = new SpecsForMvcConfig(); config.UseIISExpress() .UsePort(44300) .UseHttps() .With(Project.Named("SpecsFor.Mvc.Demo")) .CleanupPublishedFiles() .ApplyWebConfigTransformForConfig("Test");
Thanks, Markus and Dan, for your contributions!