Skip to content

Commit

Permalink
improved Renter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Jul 24, 2014
1 parent 3730dc3 commit ca50e5d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"url": "https://github.com/abarnhard/property-manager"
},
"author": "Adam Barnhard <admbarn@gmail.com>",
"contributors": ["Kayla Jones <kaylalyne424@gmail.com>"],
"license": "MIT",
"bugs": {
"url": "https://github.com/abarnhard/property-manager/issues"
Expand Down
26 changes: 24 additions & 2 deletions test/unit/renter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,33 @@ describe('Renter', function(){
});
});
describe('#work', function(){
it('should add cash to renter when he works', function(){
it('should add cash to renter when he works (social worker)', function(){
var bob = new Renter('bob', '35', 'm', 'social worker');
bob.cash = 0;
bob.work();
expect(bob.profession).to.equal('social worker');
expect(bob.cash).to.be.within(250, 5750);
expect(bob.cash).to.be.within(150, 750);
});
it('should add cash to renter when he works (movie star)', function(){
var bob = new Renter('bob', '35', 'm', 'movie star');
bob.cash = 0;
bob.work();
expect(bob.profession).to.equal('movie star');
expect(bob.cash).to.be.within(3000, 10000);
});
it('should add cash to renter when he works (coder)', function(){
var bob = new Renter('bob', '35', 'm', 'coder');
bob.cash = 0;
bob.work();
expect(bob.profession).to.equal('coder');
expect(bob.cash).to.be.within(1000, 7000);
});
it('should add cash to renter when he works (waiter)', function(){
var bob = new Renter('bob', '35', 'm', 'waiter');
bob.cash = 0;
bob.work();
expect(bob.profession).to.equal('waiter');
expect(bob.cash).to.be.within(50, 250);
});
});
describe('#payRent', function(){
Expand Down

0 comments on commit ca50e5d

Please sign in to comment.