Sha256: bff88b711bb17be70be3171195c3b181004b7e360eff286353aca225130a4cb5

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

describe Aba::Transaction do
  let(:transaction_params) { {
    :account_number => 23432342,
    :transaction_code => 53,
    :amount => 50050,
    :account_name => "John Doe",
    :payment_id => "P30234",
    :bsb => "345-453",
    :witholding_amount => 87,
    :indicator => "W",
    :lodgement_reference => "R45343",
    :trace_bsb => "123-234", 
    :trace_account_number => "4647642", 
    :name_of_remitter => "Remitter"
  } }
  subject(:transaction) { Aba::Transaction.new(transaction_params) }

  describe "#to_s" do
    it "should create a transaction row" do
      expect(subject.to_s).to include("1345-453 23432342W530000050050John Doe                        R45343            123-234  4647642Remitter        00000087")
    end
  end

  describe "#valid?" do
    it "should be valid" do
      expect(subject.valid?).to eq true
    end

    it "should not be valid" do
      transaction_params.delete(:bsb)
      expect(subject.valid?).to eq false
      expect(subject.errors).to eq ["bsb is empty", "bsb format is incorrect"]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aba-0.1.0 spec/transaction_spec.rb
aba-0.0.1 spec/transaction_spec.rb