Sha256: eed13812e40ee14ca21d79dff4b23f2ee3c3424b090b32fc8cecf645a7f0e339

Contents?: true

Size: 1004 Bytes

Versions: 4

Compression:

Stored size: 1004 Bytes

Contents

require 'spec_helper'

describe BitWallet::Address, vcr: {record: :once}, bitcoin_cleaner: true do

  let(:account) { build(:account) }
  subject { build(:address, account: account) }

  its(:account) { should == account }

  describe 'on initialization' do
    context 'no address is given' do
      it 'should create an address' do
        address = described_class.new(account)
        address.address.should_not be_blank
      end
    end

    context 'address given already exists' do
      it 'should not create an address' do
        described_class.new(account, 'addr')
        expect {
          described_class.new(account, 'addr')
        }.to_not change(account.addresses, :count)
      end
    end
  end

  describe '#total_received' do
    it 'should return the total amount received by the address' do
      subject.client.stub(:getreceivedbyaddress).
        with(subject.address, BitWallet.min_conf).
        and_return(2.1)
      subject.total_received.should == 2.1
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bit_wallet-0.7.6 spec/bit_wallet/address_spec.rb
bit_wallet-0.7.5 spec/bit_wallet/address_spec.rb
bit_wallet-0.7.3 spec/bit_wallet/address_spec.rb
bit_wallet-0.7.2 spec/bit_wallet/address_spec.rb