rspec Transaction; store transaction descriptions

This commit is contained in:
josh committed 2013-08-11 20:36:27 -04:00
1 parent aafe662acb
commit c749b17904
3 files changed
+43 -2

No files matched your search

+2 -1
View File
@@ -28,10 +28,11 @@ module Gnucash
prefix + name
end
def add_transaction(txn, value)
def add_transaction(txn, value, description)
@transactions << {
txn: txn,
value: value,
description: description,
}
end
+3 -1
View File
@@ -3,12 +3,14 @@ module Gnucash
attr_accessor :date
attr_accessor :value
attr_accessor :id
attr_accessor :description
def initialize(book, node)
@book = book
@node = node
@id = node.xpath('trn:id').text
@date = node.xpath('trn:date-posted/ts:date').text.split(' ').first
@description = node.xpath('trn:description').text
@splits = node.xpath('trn:splits/trn:split').map do |split_node|
value = Value.new(split_node.xpath('split:value').text)
account_id = split_node.xpath('split:account').text
@@ -16,7 +18,7 @@ module Gnucash
unless account
raise "Could not find account with ID #{account_id} for transaction #{@id}"
end
account.add_transaction(self, value)
account.add_transaction(self, value, description)
{
account_id: account_id,
value: value,