request needed class

This commit is contained in:
Iuri Matias 2015-06-13 09:21:29 -04:00
parent 7695c1616f
commit bda4267fa2
2 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,6 @@
SimpleStorage = require('embark-framework').Tests(); var Tests = require('embark-framework').Tests;
SimpleStorage = Tests.request("SimpleStorage");
SimpleStorage.set(100); SimpleStorage.set(100);

View File

@ -29,9 +29,9 @@ TestContractWrapper = (function() {
py_exec("example_abi") py_exec("example_abi")
py_exec("example_binary = '" + example_binary + "'.decode('hex')") py_exec("example_binary = '" + example_binary + "'.decode('hex')")
py_exec("example_binary") py_exec("example_binary")
py_exec(className + "_contract = EvmContract(example_abi, example_binary)") py_exec(this.className + "_contract = EvmContract(example_abi, example_binary)")
this.contractVariable = className + "_contract" this.contractVariable = this.className + "_contract"
}; };
TestContractWrapper.prototype.execCmd = function(method, args) { TestContractWrapper.prototype.execCmd = function(method, args) {
@ -58,15 +58,18 @@ TestContract = function(contract, className) {
return Obj; return Obj;
} }
SimpleStorage = function() { request = function(className) {
filename = './app/contracts/simple_storage.sol' filename = './app/contracts/simple_storage.sol'
source = fs.readFileSync(filename).toString() source = fs.readFileSync(filename).toString()
className = 'SimpleStorage'
compiled_contracts = web3.eth.compile.solidity(source) compiled_contracts = web3.eth.compile.solidity(source)
contract = compiled_contracts[className] contract = compiled_contracts[className]
return TestContract(contract, className) return TestContract(contract, className)
} }
module.exports = SimpleStorage; Test = {
request: request
}
module.exports = Test;