Skip to content

Instantly share code, notes, and snippets.

Created April 13, 2011 16:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/917885 to your computer and use it in GitHub Desktop.
Save anonymous/917885 to your computer and use it in GitHub Desktop.
jspec with coffeescript
JSpec.describe 'ShoppingCart', ->
before_each ->
cart = new ShoppingCart
describe 'addProducts', ->
it 'should add several products', ->
cart.addProducts('cookie')
cart.addProducts('icecream')
expect(cart).to(have, 2, 'products')
describe 'checkout', ->
it 'should throw an error when checking out with no products', ->
expect(-> cart.clear().checkout()).to(throw_error, EmptyCart)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment