Created
April 17, 2012 02:38
-
-
Save syshen/2403039 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var vows = require('vows'), | |
| assert = require('assert'), | |
| ATM = require('./atm').ATM; | |
| vows.describe("Sufficient cash").addBatch({ | |
| "When user owns 100 dollars in the bank": { | |
| "and user wants to withdraw 20 dollars from ATM": { | |
| topic: function() { var atm = new ATM(); atm.deposit(100); return atm.withdraw(20);}, | |
| "should get 20 dollars from ATM and leave 80 dollars in the account.": function(result) { | |
| assert (result === 20); | |
| } | |
| } | |
| } | |
| }).export(module); | |
| vows.describe("Insufficient cash").addBatch({ | |
| "When user owns 100 dollars in the bank": { | |
| "and user wants to withdraw 20 dollars from ATM": { | |
| topic: function() { var atm = new ATM(); atm.deposit(100); return atm.withdraw(120);}, | |
| "should not get any money from ATM and ATM should raise an Error.": function(result) { | |
| assert.throws (result, Error); | |
| } | |
| } | |
| } | |
| }).export(module); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment