Created
June 25, 2018 18:17
-
-
Save stalniy/0cc4aac920777d9fdb9207b992e66485 to your computer and use it in GitHub Desktop.
How people reuse tests
This file contains 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
describe('Invoice', function() { | |
var invoice, user; | |
describe('by default', function() { | |
beforeEach(function() { | |
user = User.create({ role: 'member' }); | |
invoice = user.invoices.create({ price: 10, currency: 'USD' }); | |
}); | |
it('has status "fraud" if amount does not equal to invoice amount', function() { | |
invoice.paid(1, 'USD'); | |
expect(invoice.status).to.equal('fraud'); | |
}); | |
it('has status "fraud" if currency does not equal to invoice currency', function() { | |
invoice.paid(10, 'ZWD'); | |
expect(invoice.status).to.equal('fraud'); | |
}); | |
}); | |
describe('when user is admin', function() { | |
beforeEach(function() { | |
user = User.create({ role: 'admin' }); | |
invoice = user.invoices.create({ price: 10, currency: 'USD' }); | |
}); | |
it('has status "paid" if amount does not equal to invoice amount', function() { | |
invoice.paid(1, 'USD'); | |
expect(invoice.status).to.equal('paid'); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment