Overview
In your application code, you probably try to adhere to the DRY principle: Don't Repeat Yourself. Why shouldn't you do the same thing with your test code? Unfortunately, most modern frameworks don't really provide you with many tools for keeping your specs DRY. That's where SpecsFor really shines.
SpecsFor includes a convention system that you can use to alter the behavior of your specs. You can encapsulate behaviors, such as starting and rolling back a transaction, and apply those behaviors to your specs based on whatever conventions you defined.
In this section, we'll look at how to specify conventions, create behaviors, and apply them to our specs.
Updated less than a minute ago