Commit db40fd31 by Jakub Wojciechowski Committed by Francisco Giordano

sanity check for CappedCrowdsale: cap > 0

parent 6035bd52
......@@ -13,6 +13,7 @@ contract CappedCrowdsale is Crowdsale {
uint256 public cap;
function CappedCrowdsale(uint256 _cap) {
require(_cap > 0);
cap = _cap;
}
......
......@@ -19,6 +19,15 @@ contract('CappedCrowdsale', function ([_, wallet]) {
const cap = ether(300)
const lessThanCap = ether(60)
describe('creating a valid crowdsale', function () {
it('should fail with zero cap', async function () {
await CappedCrowdsale.new(this.startBlock, this.endBlock, rate, wallet, 0).should.be.rejectedWith(EVMThrow);
})
});
beforeEach(async function () {
this.startBlock = web3.eth.blockNumber + 10
this.endBlock = web3.eth.blockNumber + 20
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment