Sha256: a1a8135f12ded061ae3fd7c809237b02e8b01f2ae06dc2fb59e4c60b9ad1b935

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

describe BitWallet::Wallet, vcr: true do

  describe '#accounts' do
    it 'should return array of BitWallet::Accounts' do
      wallet = build(:wallet)
      wallet.accounts.should be_kind_of(BitWallet::Accounts)
    end
  end

  describe '#recent_transactions' do
    it 'should return the most recent transactions of all accounts defaulting to 10 transactions' do
      wallet = build(:wallet)
      default_account = wallet.accounts.new('')
      account_1 = wallet.accounts.new('1')

      1.upto(11).each do |n|
        default_account.send_amount n, to: account_1.addresses.first
      end

      wallet.recent_transactions.size.should == 10
    end

    it 'should allow overriding of the transaction limit' do
      wallet = build(:wallet)
      default_account = wallet.accounts.new('')
      account_1 = wallet.accounts.new('1')

      1.upto(11).each do |n|
        default_account.send_amount n, to: account_1.addresses.first
      end

      wallet.recent_transactions(limit: 5).size.should == 5
    end
  end

  describe '#move' do
    it 'should move funds from one account to another' do
      wallet = build(:wallet)
      default_account = wallet.accounts.new('')
      account_1 = wallet.accounts.new('1')
      wallet.move '', '1', 1.1
      wallet.move default_account, account_1, 0.5
      account_1.balance.should == 1.6
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bit_wallet-0.6.0 spec/bit_wallet/wallet_spec.rb
bit_wallet-0.5.0 spec/bit_wallet/wallet_spec.rb
bit_wallet-0.4.0 spec/bit_wallet/wallet_spec.rb