Feature: get cash from an ATM
Background:
Given the ATM has 1000
And the user John is authenticated
And the user's account has 5000
Scenario: success
When the user asks the ATM for 500
Then the ATM will have 500
And the user's account will have 4500
And the ATM will provide 500 in cash
Scenario: not enough money in the ATM
When the user asks the ATM for 1500
Then the ATM will have 1000
And the user's account will have 5000
And the ATM will notify the user it does not have enough cash
describe('Feature: get cash from an ATM:', function() {
context('Scenario: success', function() {
describe('When the user asks the ATM for 500', function() {
it('Then the ATM will have 500', function() {
expect(world().getATM().remainingCash()).to.be.eql(500);
});
it("Then the user's account will have 4500", function(done) {
world().getDB().accountFor(userId).then(function(acc) {
expect(cash).to.be.eql(acc.cash);
}).then(done, done);
});
});
});
});