[rspec-users] Spec Naming (was: Rspec Brown Bag)

David Chelimsky dchelimsky at gmail.com
Tue Nov 21 10:12:09 EST 2006

On 11/21/06, Nick Sieger <nicksieger at gmail.com> wrote:
> Thanks for posting your specdoc, Brandon -- they're a great example.
> On 11/21/06, Brandon Keepers <bkeepers at gmail.com > wrote:
> >
> > A user purchasing items
> > - should create an order
> > - should add to the user's orders
> > - should create line items
> > - should set line item amount to the item's price
> > - should set line item amount to 0 if item does not have a price
> However, I've found myself now naming the specs themselves without the
> "should" language, thinking that the spec body is where the should stuff
> goes.  I like how the specdoc reads more confidently without it -- the spec
> doc says, "this is the way things are" rather than "this is kinda sorta
> maybe how the system works (if there are no bugs)".
> context "A user purchasing items" do
>   specify "creates an order" do
>     @user.complete_purchase.should_be_instance_of Order
>   end
>   # ...
> end
> It's just a matter of taste in the end, I suppose, but is there a
> recommended practice for naming specs?

When you look at the specs what you propose makes sense, however when
you read the output I think using "should" in the names helps to
convey the "spec-ness" of the specs. To me.

More information about the rspec-users mailing list