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

Nick Sieger nicksieger at gmail.com
Tue Nov 21 09:01:03 EST 2006


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?

Cheers,
/Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061121/5b9031f4/attachment.html 


More information about the rspec-users mailing list