Sha256: 1ea75b4dea8a4b96eb6527831e3f9029def76bb3755f6b91b95d09d809effac0

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

module BitWallet
  describe Accounts, vcr: {record: :once} do

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

    subject do
      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(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)
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bit_wallet-0.7.1 spec/bit_wallet/accounts_spec.rb
bit_wallet-0.7.0 spec/bit_wallet/accounts_spec.rb
bit_wallet-0.6.1 spec/bit_wallet/accounts_spec.rb