Sha256: 206c7c805695aca3c09da92cdfdbe21afeefa8622094724ee923d6ef60c29d6e
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe Etherscan::Tokens do let(:connection_mock) { instance_double('Client') } let(:connection_params) do { key: 'foobar' } end let(:contract) { 'contract' } let(:address) { 'address' } subject { Etherscan::Tokens.new(connection_params) } before do allow(Etherscan::Client).to receive(:new).with(connection_params).and_return(connection_mock) end it '#total_supply' do response = { 'status' => '1', 'message' => 'OK', 'result' => '75974982082112433807172752' } params = { module: 'stats', action: 'tokensupply', contractaddress: contract } expect(connection_mock).to receive(:get).with(params).and_return(response) expected_response = subject.total_supply(contract) expect(expected_response).to eq(response['result']) end it '#balance' do response = { 'status' => '1', 'message' => 'OK', 'result' => '34080719924110000000000' } params = { module: 'account', action: 'tokenbalance', address: address, contractaddress: contract } expect(connection_mock).to receive(:get).with(params).and_return(response) expected_response = subject.balance(address, contract) expect(expected_response).to eq(response['result']) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
etherscan_api-0.4.0 | spec/etherscan/tokens_spec.rb |
etherscan_api-0.3.0 | spec/etherscan/tokens_spec.rb |
etherscan_api-0.2.0 | spec/etherscan/tokens_spec.rb |