Browse Source

write ownable simple test

Manuel Araoz 9 years ago
parent
commit
825203fcec
3 changed files with 13 additions and 1 deletions
  1. 1 1
      contracts/Ownable.sol
  2. 1 0
      migrations/2_deploy_contracts.js
  3. 11 0
      test/ownable.js

+ 1 - 1
contracts/Ownable.sol

@@ -3,7 +3,7 @@
  * Base contract with an owner
  * Base contract with an owner
  */
  */
 contract Ownable {
 contract Ownable {
-  address owner;
+  address public owner;
 
 
   function Ownable() {
   function Ownable() {
     owner = msg.sender;
     owner = msg.sender;

+ 1 - 0
migrations/2_deploy_contracts.js

@@ -2,5 +2,6 @@ module.exports = function(deployer) {
   deployer.deploy(PullPaymentBid);
   deployer.deploy(PullPaymentBid);
   deployer.deploy(BadArrayUse);
   deployer.deploy(BadArrayUse);
   deployer.deploy(Bounty);
   deployer.deploy(Bounty);
+  deployer.deploy(Ownable);
   deployer.deploy(LimitFunds);
   deployer.deploy(LimitFunds);
 };
 };

+ 11 - 0
test/ownable.js

@@ -0,0 +1,11 @@
+contract('Ownable', function(accounts) {
+  it("should have an owner", function(done) {
+    var ownable = Ownable.deployed();
+    return ownable.owner()
+    .then(function(owner) {
+      assert.isTrue(owner != 0);
+    })
+    .then(done)
+
+  });
+});