Sha256: d0a9f993532de25a0d0fa4c7533856c7e91f8db06d022278551e9e322496e2ec

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe BitWallet::Accounts, vcr: true do

  let(:wallet) do
    build(:wallet)
  end

  subject do
    BitWallet::Accounts.new(wallet)
  end

  its(:wallet) { should == wallet }

  describe '#new' do
    it 'should create a new BitWallet::Account with a default address' do
      account = wallet.accounts.new('accountname')
      account.should be_kind_of(BitWallet::Account)
      account.addresses.count.should == 1
    end
  end

  describe '#includes_account_name?(account)' do
    it 'should return true if the array includes the account' do
      account = subject.new('accountname')
      subject.includes_account_name?('accountname').should == true
    end
  end

  describe '.with_balance' do
    it 'should return accounts with a balance > 0' do
      default_account = subject.new('')
      account_1 = subject.new('nomoney')
      account_2 = subject.new('moneyd')

      default_account.send_amount 10, to: account_2.addresses.first

      accounts_with_balance = subject.with_balance
      accounts_with_balance.should include(default_account)
      accounts_with_balance.should_not include(account_1)
      accounts_with_balance.should include(account_2)

      account_1.send_amount account_1.balance, to: default_account.addresses.first

      subject.with_balance.should_not include(account_1)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bit_wallet-0.4.0 spec/bit_wallet/accounts_spec.rb
bit_wallet-0.3.0 spec/bit_wallet/accounts_spec.rb
bit_wallet-0.2.0 spec/bit_wallet/accounts_spec.rb
bit_wallet-0.1.1 spec/bit_wallet/accounts_spec.rb