Permalink
Browse files

standard totals - refactored

  • Loading branch information...
1 parent da69f9f commit 796604b405ba76fb8d241c377dfec37af44b374f @iainjmitchell committed Apr 21, 2012
Showing with 21 additions and 4 deletions.
  1. +9 −2 coffee/ShoppingKata_tests.coffee
  2. +12 −2 src/ShoppingKata_tests.js
@@ -48,6 +48,13 @@ vows.describe('checkout tests')
undefined
'total is 80': (err, total) ->
assert.equal total, 80
+ 'special offers'
+ 'when three A':
+ topic: () ->
+ new Checkout(@callback, prices).scan('A').scan('A').scan('A').total()
+ undefined
+ 'total is 130': (err, total) ->
+ assert.equal total, 130
)
.run()
@@ -58,13 +65,13 @@ class Checkout
@scanner = new Scanner(@prices)
@scanner.on 'NewItem', (itemInfo) ->
totaller.add(itemInfo.price)
- @totaller1 = totaller
+ @totaller = totaller
scan: (item) ->
@scanner.scan(item)
this
total: () ->
- @totaller1.total()
+ @totaller.total()
class Scanner extends EventEmitter
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 796604b

Please sign in to comment.