From d0a712ec066fcd8ca6a829ea6da2b95a0d41c04b Mon Sep 17 00:00:00 2001 From: Cyrille Labesse Date: Tue, 26 Sep 2017 20:26:27 -0700 Subject: [PATCH 1/3] add configurable endpoint and HTTP port --- spec/client_spec.rb | 4 ++-- spec/ethereum_spec.rb | 4 ++-- spec/spec_helper.rb | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 728a1db..2d04929 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -3,14 +3,14 @@ describe Ethereum do describe 'HttpClient' do it 'should work' do - client = Ethereum::HttpClient.new('localhost', '8545') + client = Ethereum::HttpClient.new('localhost', ENV['ETH_HTTP_PORT']) expect(client.eth_accounts['error']).to eq(nil) end end describe 'IpcClient' do before(:each) do - @client = Ethereum::IpcClient.new("#{ENV['HOME']}/EtherDev/data/geth.ipc") + @client = Ethereum::IpcClient.new(ENV['ETH_IPC_PATH']) end it 'should work' do diff --git a/spec/ethereum_spec.rb b/spec/ethereum_spec.rb index c930683..ff28b7c 100644 --- a/spec/ethereum_spec.rb +++ b/spec/ethereum_spec.rb @@ -3,7 +3,7 @@ describe Ethereum do before(:all) do - @client = Ethereum::HttpClient.new("172.16.135.102", "8545") + @client = Ethereum::HttpClient.new("loclhost", ENV['ETH_HTTP_PORT']) @formatter = Ethereum::Formatter.new end @@ -12,7 +12,7 @@ expect(Ethereum::VERSION).to eq("0.4.90") end end - + describe "Deployment" do it "should deploy a contract with parameters" do @init = Ethereum::Initializer.new("#{ENV['PWD']}/spec/fixtures/ContractWithParams.sol", @client) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c7f3a02..f098dcb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,6 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'ethereum' require 'pry' + +ENV['ETH_HTTP_PORT'] ||= '8545' +ENV['ETH_IPC_PATH'] ||= "#{ENV['HOME']}/EtherDev/data/geth.ipc" From b36a74ddd2b2f6aa47a035b04188447cd037db6b Mon Sep 17 00:00:00 2001 From: Cyrille Labesse Date: Tue, 26 Sep 2017 20:26:47 -0700 Subject: [PATCH 2/3] update version spec --- spec/ethereum_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/ethereum_spec.rb b/spec/ethereum_spec.rb index ff28b7c..058a347 100644 --- a/spec/ethereum_spec.rb +++ b/spec/ethereum_spec.rb @@ -9,7 +9,7 @@ describe "Ethereum Version" do it 'has a version number' do - expect(Ethereum::VERSION).to eq("0.4.90") + expect(Ethereum::VERSION).to eq("1.5.2") end end From 10eda7bdf932effac7f571fc4bae5446f1a6a4d1 Mon Sep 17 00:00:00 2001 From: Cyrille Labesse Date: Tue, 26 Sep 2017 20:27:47 -0700 Subject: [PATCH 3/3] deactivate contract ethereum spec --- spec/ethereum_spec.rb | 66 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/spec/ethereum_spec.rb b/spec/ethereum_spec.rb index 058a347..01291d8 100644 --- a/spec/ethereum_spec.rb +++ b/spec/ethereum_spec.rb @@ -13,38 +13,36 @@ end end - describe "Deployment" do - it "should deploy a contract with parameters" do - @init = Ethereum::Initializer.new("#{ENV['PWD']}/spec/fixtures/ContractWithParams.sol", @client) - @init.build_all - @contract_with_params = ContractWithParams.new - @coinbase = @contract_with_params.connection.coinbase["result"] - @contract_with_params.deploy_and_wait(60, @coinbase) - address = @contract_with_params.call_get_setting__ - expect(address).to eq(@coinbase) - end - - end - - - describe "Basic contract testing" do - - before(:all) do - @init = Ethereum::Initializer.new("#{ENV['PWD']}/spec/fixtures/SimpleNameRegistry.sol", @client) - @init.build_all - @simple_name_registry = SimpleNameRegistry.new - @simple_name_registry.deploy_and_wait(60) - end - - it "should perform a contract transaction, wait for its completion, return an Ethereum::Transaction object" do - tx = @simple_name_registry.transact_and_wait_register("0x5b6cb65d40b0e27fab87a2180abcab22174a2d45", "minter.contract.dgx") - expect(tx.class).to be(Ethereum::Transaction) - end - - it "should test a call_(Ethereum Contract Function)" do - expect(true).to be(true) - end - - end - + # Disabled specs due to: "eth_compilers, eth_compileSolidity are gone in go-ethereum 1.6.0" + # https://github.com/ethereum/go-ethereum/issues/3793 + # describe "Deployment" do + # it "should deploy a contract with parameters" do + # @init = Ethereum::Initializer.new("#{ENV['PWD']}/spec/fixtures/ContractWithParams.sol", @client) + # @init.build_all + # @contract_with_params = ContractWithParams.new + # @coinbase = @contract_with_params.connection.coinbase["result"] + # @contract_with_params.deploy_and_wait(60, @coinbase) + # address = @contract_with_params.call_get_setting__ + # expect(address).to eq(@coinbase) + # end + # end + + + # describe "Basic contract testing" do + # before(:all) do + # @init = Ethereum::Initializer.new("#{ENV['PWD']}/spec/fixtures/SimpleNameRegistry.sol", @client) + # @init.build_all + # @simple_name_registry = SimpleNameRegistry.new + # @simple_name_registry.deploy_and_wait(60) + # end + + # it "should perform a contract transaction, wait for its completion, return an Ethereum::Transaction object" do + # tx = @simple_name_registry.transact_and_wait_register("0x5b6cb65d40b0e27fab87a2180abcab22174a2d45", "minter.contract.dgx") + # expect(tx.class).to be(Ethereum::Transaction) + # end + + # it "should test a call_(Ethereum Contract Function)" do + # expect(true).to be(true) + # end + # end end