banco 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -0
- data/README.md +141 -0
- data/bin/banco +97 -43
- data/lib/banco/bank_format.rb +67 -0
- data/lib/banco/cli.rb +92 -0
- data/lib/banco/file_picker.rb +45 -0
- data/lib/banco/formatter/base.rb +37 -0
- data/lib/banco/formatter/csv_formatter.rb +21 -0
- data/lib/banco/formatter/json_formatter.rb +29 -0
- data/lib/banco/formatter/text.rb +143 -0
- data/lib/banco/grouper.rb +50 -0
- data/lib/banco/parser.rb +39 -0
- data/lib/banco/report.rb +10 -0
- data/lib/banco/transaction.rb +50 -28
- data/lib/banco/version.rb +5 -0
- data/lib/banco.rb +17 -0
- metadata +231 -30
- data/README +0 -12
- data/lib/banco/get_file.rb +0 -41
- data/lib/banco/reader.rb +0 -67
- data/lib/banco/reporter.rb +0 -76
- data/lib/banco/viewable.rb +0 -180
- data/spec/banco/reader_spec.rb +0 -14
- data/spec/banco/reporter_spec.rb +0 -54
- data/spec/banco/transaction_spec.rb +0 -47
data/lib/banco/get_file.rb
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
module Banco
|
|
2
|
-
class GetFile
|
|
3
|
-
attr_reader :name, :csv_file_name, :summary_name
|
|
4
|
-
|
|
5
|
-
def initialize
|
|
6
|
-
@csv_file_name = gets.chomp.downcase
|
|
7
|
-
if @csv_file_name == 'q'
|
|
8
|
-
Viewable::farewell
|
|
9
|
-
exit
|
|
10
|
-
else
|
|
11
|
-
file_checker_cleaner(@csv_file_name)
|
|
12
|
-
@name = @csv_file_name.split('.').first
|
|
13
|
-
@doctype = @csv_file_name.split('.').last
|
|
14
|
-
@summary_name = @name
|
|
15
|
-
@csv_file_name
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def file_checker_cleaner(filename)
|
|
20
|
-
if filename =~/([^\s]+(\.csv)$)/
|
|
21
|
-
puts "\nloading #{filename}..."
|
|
22
|
-
else
|
|
23
|
-
puts "#{filename} won't work !".center(54)
|
|
24
|
-
puts "try again or 'q' to exit".center(54)
|
|
25
|
-
make_name
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
if __FILE__ == $0
|
|
33
|
-
file = Banco::GetFile.new()
|
|
34
|
-
file.make_name
|
|
35
|
-
puts "\n\n\n"
|
|
36
|
-
p file.valid_file
|
|
37
|
-
p file.name
|
|
38
|
-
p file.summary_name
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
|
data/lib/banco/reader.rb
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
require_relative 'transaction'
|
|
2
|
-
require_relative 'viewable'
|
|
3
|
-
require 'csv'
|
|
4
|
-
|
|
5
|
-
module Banco
|
|
6
|
-
class Reader
|
|
7
|
-
include Viewable
|
|
8
|
-
|
|
9
|
-
attr_reader :all_from_csv, :report_name, :csv_file_name
|
|
10
|
-
|
|
11
|
-
def initialize(csv_file_name, report_name)
|
|
12
|
-
@csv_file_name = csv_file_name
|
|
13
|
-
@report_name = report_name
|
|
14
|
-
@all_from_csv = []
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def read_in_csv_data
|
|
18
|
-
begin
|
|
19
|
-
@csv_row_count = 1
|
|
20
|
-
|
|
21
|
-
CSV.foreach(csv_file_name) do |row|
|
|
22
|
-
all_from_csv << Transaction.new(row[0],row[1],row[2],row[3],row[4],@csv_row_count)
|
|
23
|
-
@csv_row_count += 1
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
rescue ArgumentError => e
|
|
27
|
-
non_numeric_in_csv(e, @csv_row_count)
|
|
28
|
-
puts "sorted ? ('y' to continue or 'q' to exit)".rjust(54)
|
|
29
|
-
input = gets.chomp.downcase
|
|
30
|
-
@all_from_csv = []
|
|
31
|
-
input == "y" ? retry : Viewable::farewell
|
|
32
|
-
|
|
33
|
-
rescue Errno::ENOENT => e
|
|
34
|
-
puts "Can't find file #{@csv_file_name} - have another go or (q) quit\n\n"
|
|
35
|
-
loop do
|
|
36
|
-
input = gets.chomp.downcase
|
|
37
|
-
case input
|
|
38
|
-
when 'q'
|
|
39
|
-
Viewable::farewell
|
|
40
|
-
exit
|
|
41
|
-
when /([^\s]+(\.csv)$)/
|
|
42
|
-
@csv_file_name = input
|
|
43
|
-
break
|
|
44
|
-
else
|
|
45
|
-
puts "\ninvalid file - try again or 'q' to quit\n\n"
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
retry
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def non_numeric_in_csv(exception, row_number)
|
|
53
|
-
reason = exception.message.split(':')
|
|
54
|
-
puts "Please check row #{row_number} of #{@csv_file_name},"
|
|
55
|
-
puts "#{reason.last} should be a numeric value".rjust(54)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
if __FILE__ == $0
|
|
61
|
-
reader = Banco::Reader.new("test.csv", "test")
|
|
62
|
-
reader.read_in_csv_data
|
|
63
|
-
puts reader.report_name
|
|
64
|
-
puts reader.csv_file_name
|
|
65
|
-
puts reader.all_from_csv
|
|
66
|
-
p reader
|
|
67
|
-
end
|
data/lib/banco/reporter.rb
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
require_relative 'transaction'
|
|
2
|
-
require_relative 'reader'
|
|
3
|
-
require_relative 'viewable'
|
|
4
|
-
require 'csv'
|
|
5
|
-
|
|
6
|
-
module Banco
|
|
7
|
-
class Reporter
|
|
8
|
-
|
|
9
|
-
include Viewable
|
|
10
|
-
|
|
11
|
-
attr_reader :all_transactions,
|
|
12
|
-
:outgoing_trans,
|
|
13
|
-
:incoming_trans,
|
|
14
|
-
:outgoings,
|
|
15
|
-
:incomings,
|
|
16
|
-
:outgoing_total,
|
|
17
|
-
:incoming_total,
|
|
18
|
-
:name,
|
|
19
|
-
:csv_file_name
|
|
20
|
-
|
|
21
|
-
def initialize(csv_file_name, report_name, transactions)
|
|
22
|
-
@csv_file_name = csv_file_name
|
|
23
|
-
@name = report_name
|
|
24
|
-
@all_transactions = transactions
|
|
25
|
-
@outgoing_trans = []
|
|
26
|
-
@incoming_trans = []
|
|
27
|
-
@outgoings = Hash.new(0)
|
|
28
|
-
@incomings = Hash.new(0)
|
|
29
|
-
puts "formating data..."
|
|
30
|
-
remove_blank_lines
|
|
31
|
-
split_in_out
|
|
32
|
-
total_outgoing
|
|
33
|
-
total_incoming
|
|
34
|
-
puts "\n\n"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def remove_blank_lines
|
|
39
|
-
@all_transactions.delete_if{|trans| trans.moneyin == 0 && trans.moneyout == 0}
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def split_in_out
|
|
43
|
-
@outgoing_trans, @incoming_trans = @all_transactions.partition{|trans| trans.moneyin == 0 && trans.moneyout > 0}
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def total_outgoing
|
|
47
|
-
@outgoing_trans.each{|trans| @outgoings[trans.description[0..8]] += trans.moneyout}
|
|
48
|
-
@outgoing_total = @outgoings.values.map.reduce(:+)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def total_incoming
|
|
52
|
-
@incoming_trans.each{|trans| @incomings[trans.description[0..8]] += trans.moneyin}
|
|
53
|
-
@incoming_total = @incomings.values.map.reduce(:+)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if __FILE__ == $0
|
|
60
|
-
reader = Banco::Reader.new("test.csv", "test")
|
|
61
|
-
reader.read_in_csv_data
|
|
62
|
-
puts "\n\n\n#all csv data from reader object\n\n"
|
|
63
|
-
puts "#{reader.all_from_csv}\n\n"
|
|
64
|
-
report = Banco::Reporter.new(reader.csv_file_name, reader.report_name, reader.all_from_csv)
|
|
65
|
-
puts "#{report.name} is the Reporter object's name\nReporter object contents below, (3 arrays, 2 hashes):\n\n"
|
|
66
|
-
puts "\n\nall transactions array\n"
|
|
67
|
-
p report.all_transactions
|
|
68
|
-
puts "\n\noutgoings array\n"
|
|
69
|
-
p report.outgoing_trans
|
|
70
|
-
puts "\n\nincomings array\n"
|
|
71
|
-
p report.incoming_trans
|
|
72
|
-
puts "\n\nOutgoings hash\n"
|
|
73
|
-
p report.outgoings
|
|
74
|
-
puts "\n\nIncomings hash\n"
|
|
75
|
-
p report.incomings
|
|
76
|
-
end
|
data/lib/banco/viewable.rb
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
module Banco
|
|
2
|
-
module Viewable
|
|
3
|
-
def menu
|
|
4
|
-
puts "Enter :\n"
|
|
5
|
-
puts "'a' to view all transactions"
|
|
6
|
-
puts "'o' to view all outgoing transactions"
|
|
7
|
-
puts "'i' to view all incoming transactions"
|
|
8
|
-
puts "'m' for money out summary"
|
|
9
|
-
puts "'n' for money in summary"
|
|
10
|
-
puts "'b' for the bottom line"
|
|
11
|
-
puts "'s' to save summaries to file"
|
|
12
|
-
puts "'t' to save transactions to file"
|
|
13
|
-
puts "\n'l' to load a new file\n"
|
|
14
|
-
puts "\nor 'q' to quit\n\n\n"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def to_pounds(money)
|
|
18
|
-
format = sprintf("%10.2f", money.truncate(2))
|
|
19
|
-
"£#{format}"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def dashes
|
|
23
|
-
"---".center(55,"-")
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def date_range
|
|
27
|
-
"(#{self.all_transactions.last.date} - #{self.all_transactions.first.date})"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def facts(transactions)
|
|
31
|
-
"#{transactions.size} transactions for period #{date_range}"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def money_out_summary
|
|
35
|
-
print_summary("Outgoings", self.outgoings, self.outgoing_total)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def money_in_summary
|
|
39
|
-
print_summary("Incomings", self.incomings, self.incoming_total)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def transactions_all
|
|
43
|
-
output = ""
|
|
44
|
-
output << dashes
|
|
45
|
-
output << "\n"
|
|
46
|
-
output << "All transactions:\n"
|
|
47
|
-
output << "#{facts(self.all_transactions)}\n\n"
|
|
48
|
-
self.all_transactions.each do |trans|
|
|
49
|
-
if trans.moneyout == 0
|
|
50
|
-
output << "#{trans} + #{to_pounds(trans.moneyin)}\n"
|
|
51
|
-
else
|
|
52
|
-
output << "#{trans} - #{to_pounds(trans.moneyout)}\n"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
output << dashes
|
|
56
|
-
output << "\n\n"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def transactions_out
|
|
60
|
-
output = ""
|
|
61
|
-
output << dashes
|
|
62
|
-
output << "\n"
|
|
63
|
-
output << "Outgoing Transactions:\n"
|
|
64
|
-
output << "#{facts(self.outgoing_trans)}\n\n"
|
|
65
|
-
self.outgoing_trans.each{|trans| output << "#{trans} - #{to_pounds(trans.moneyout)}\n"}
|
|
66
|
-
output << dashes
|
|
67
|
-
output << "\n\n"
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def transactions_in
|
|
71
|
-
output = ""
|
|
72
|
-
output << dashes
|
|
73
|
-
output << "\n"
|
|
74
|
-
output << "Incoming Transactions :\n"
|
|
75
|
-
output << "#{facts(self.incoming_trans)}\n\n"
|
|
76
|
-
self.incoming_trans.each{|trans| output << "#{trans} + #{to_pounds(trans.moneyin)}\n"}
|
|
77
|
-
output << dashes
|
|
78
|
-
output << "\n\n"
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def print_summary(kind, hash, total)
|
|
82
|
-
output = ""
|
|
83
|
-
output << dashes
|
|
84
|
-
output << "\n"
|
|
85
|
-
output << "#{kind} Summary, totals from #{hash.size} different sources :\n"
|
|
86
|
-
output << "#{date_range}\n"
|
|
87
|
-
hash.sort_by{|_k,v| v}.reverse.each{|k,v| output << "#{k} #{to_pounds(v)}\n".rjust(54)}
|
|
88
|
-
output << "\n"
|
|
89
|
-
output << "Total #{kind}: #{to_pounds(total)}\n".rjust(54)
|
|
90
|
-
output << dashes
|
|
91
|
-
output << "\n\n"
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def bottom_line
|
|
95
|
-
output = ""
|
|
96
|
-
output << dashes
|
|
97
|
-
output << "\n"
|
|
98
|
-
output << "#{facts(self.all_transactions)}".rjust(54)
|
|
99
|
-
output << "\n\n"
|
|
100
|
-
output << "Money In : #{to_pounds(self.incoming_total)}".rjust(54)
|
|
101
|
-
output << "\n"
|
|
102
|
-
output << "Money Out : #{to_pounds(self.outgoing_total)}".rjust(54)
|
|
103
|
-
output << "\n\n"
|
|
104
|
-
diff = self.incoming_total - self.outgoing_total
|
|
105
|
-
if self.outgoing_total > self.incoming_total
|
|
106
|
-
output << "Outgoings exceed Incomings, DEFICIT of #{to_pounds(diff)}".rjust(54)
|
|
107
|
-
else
|
|
108
|
-
output << "Incomings exceed Outgoings, SURPLUS of #{to_pounds(diff)}".rjust(54)
|
|
109
|
-
end
|
|
110
|
-
output << "\n"
|
|
111
|
-
output << dashes
|
|
112
|
-
output << "\n\n"
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def self.farewell
|
|
116
|
-
puts "\n\n"
|
|
117
|
-
puts "*".center(55,'*')
|
|
118
|
-
puts " Banco ".center(55,'*')
|
|
119
|
-
puts " hope your numbers were positive ".center(55,'*')
|
|
120
|
-
puts " code@s33d.co ".center(55,'*')
|
|
121
|
-
puts "*".center(55,'*')
|
|
122
|
-
puts "\n\n\n"
|
|
123
|
-
exit
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def self.hello
|
|
127
|
-
puts "\n\n"
|
|
128
|
-
puts "Banco will summarize your bank statements.".center(55)
|
|
129
|
-
puts "import a .csv file for review".center(55)
|
|
130
|
-
puts "\n\n"
|
|
131
|
-
puts "the .csv file should have :".center(55)
|
|
132
|
-
puts "NO headers".center(55)
|
|
133
|
-
puts "with columns ordered (left to right)".center(55)
|
|
134
|
-
puts "date - description - type - money in - money out".center(55)
|
|
135
|
-
puts "all additional columns will be ignored".center(55)
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def self.prompt
|
|
139
|
-
puts "\n\n"
|
|
140
|
-
puts "Enter the name of you .csv file to review".center(54)
|
|
141
|
-
puts "(use 'test.csv' for the test file)".center(54)
|
|
142
|
-
puts "or 'q' to quit...".center(55)
|
|
143
|
-
puts "\n\n"
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
def save_summary_to_file(to_file="#{self.name}_summary.txt")
|
|
147
|
-
File.open(to_file, "w") do |file|
|
|
148
|
-
t = Time.now
|
|
149
|
-
file.puts t.strftime("\n\nprinted : %d %b %y at %I:%M%P")
|
|
150
|
-
file.puts "summarized by Banco from #{self.csv_file_name}"
|
|
151
|
-
file.puts "\n"
|
|
152
|
-
file.puts self.money_out_summary
|
|
153
|
-
file.puts "\n"
|
|
154
|
-
file.puts self.money_in_summary
|
|
155
|
-
file.puts "\n"
|
|
156
|
-
file.puts self.bottom_line
|
|
157
|
-
file.puts "\n"
|
|
158
|
-
file.puts "code@s33d.co".rjust(54)
|
|
159
|
-
end
|
|
160
|
-
puts "\n\nfile saved as #{self.name}_summary.txt\n\n"
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def save_transactions_to_file(to_file="#{self.name}_transactions.txt")
|
|
164
|
-
File.open(to_file, "w") do |file|
|
|
165
|
-
t = Time.now
|
|
166
|
-
file.puts t.strftime("\n\nprinted : %d %b %y at %I:%M%P")
|
|
167
|
-
file.puts "summarized by Banco from #{self.csv_file_name}"
|
|
168
|
-
file.puts "\n"
|
|
169
|
-
file.puts self.transactions_out
|
|
170
|
-
file.puts "\n"
|
|
171
|
-
file.puts self.transactions_in
|
|
172
|
-
file.puts "\n"
|
|
173
|
-
file.puts self.bottom_line
|
|
174
|
-
file.puts "\n"
|
|
175
|
-
file.puts "code@s33d.co".rjust(54)
|
|
176
|
-
end
|
|
177
|
-
puts "\n\nfile saved as #{self.name}_transactions.txt\n\n"
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
|
-
end
|
data/spec/banco/reader_spec.rb
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
require 'banco/reader'
|
|
2
|
-
module Banco
|
|
3
|
-
describe Reader do
|
|
4
|
-
before do
|
|
5
|
-
csv_file_name = "test.csv"
|
|
6
|
-
report_name = "test"
|
|
7
|
-
@testreader = Banco::Reader.new(csv_file_name, report_name)
|
|
8
|
-
@testreader.read_in_csv_data
|
|
9
|
-
end
|
|
10
|
-
it "should produce an array for all rows on csv file" do
|
|
11
|
-
expect(@testreader.all_from_csv.length).to eq(10)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
data/spec/banco/reporter_spec.rb
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require 'banco/reporter'
|
|
2
|
-
require 'banco/reader'
|
|
3
|
-
module Banco
|
|
4
|
-
describe Reporter do
|
|
5
|
-
before do
|
|
6
|
-
csv_file_name = "test.csv"
|
|
7
|
-
report_name = "test"
|
|
8
|
-
@testreader = Banco::Reader.new(csv_file_name, report_name)
|
|
9
|
-
@testreader.read_in_csv_data
|
|
10
|
-
@tester = Banco::Reporter.new('test.csv', 'test', @testreader.all_from_csv)
|
|
11
|
-
@tester.remove_blank_lines
|
|
12
|
-
@tester.split_in_out
|
|
13
|
-
@tester.total_outgoing
|
|
14
|
-
@tester.total_incoming
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "should remove transactions with zero values (moneyin / moneyout)" do
|
|
18
|
-
expect(@tester.all_transactions.size).to eq(8)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
it "should produce an array of incoming transactions" do
|
|
23
|
-
expect(@tester.incoming_trans.size).to eq(4)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should produce an array of outgoing transactions" do
|
|
27
|
-
expect(@tester.outgoing_trans.size).to eq(4)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should produce a hash of outgoing transactions" do
|
|
31
|
-
expect(@tester.outgoings.size).to eq(2)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "should produce a hash of incoming transactions" do
|
|
35
|
-
expect(@tester.incomings.size).to eq(2)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "should sum incoming transactions by matching description string" do
|
|
39
|
-
expect(@tester.incomings['INCOMING2']).to eq(183.34)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "should sum outgoing transactions by matching description string" do
|
|
43
|
-
expect(@tester.outgoings['OUTGOING2']).to eq(182.68)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "should sum total incoming transactions" do
|
|
47
|
-
expect(@tester.incoming_total).to eq(321.58)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it "should sum total outgoing transactions" do
|
|
51
|
-
expect(@tester.outgoing_total).to eq(320.92)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require 'banco/transaction'
|
|
2
|
-
|
|
3
|
-
module Banco
|
|
4
|
-
describe Transaction do
|
|
5
|
-
before do
|
|
6
|
-
@trans1 = Transaction.new("12/01/17","some transaction", "credit", "57.91", "0.00", "1")
|
|
7
|
-
@trans2 = Transaction.new("13/01/17","some other transaction", "debit", "0.00", "57.91",'2')
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# it "Should convert money in values to pence" do
|
|
11
|
-
# expect(@trans1.moneyin).to eq(5791)
|
|
12
|
-
# end
|
|
13
|
-
|
|
14
|
-
# it "Should convert money out values to pence" do
|
|
15
|
-
# expect(@trans2.moneyout).to eq(5791)
|
|
16
|
-
# end
|
|
17
|
-
|
|
18
|
-
it "Should have a description string of 22 characters (upcase)" do
|
|
19
|
-
expect(@trans2.description).to eq("SOME OTHER TRANSACTION")
|
|
20
|
-
expect(@trans1.description).to eq("SOME TRANSACTION ")
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "Should have a type string upcased and 8 characters long" do
|
|
24
|
-
expect(@trans2.type).to eq("DEBIT ")
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "Should have a date string" do
|
|
28
|
-
expect(@trans1.date).to eq("12/01/17")
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "Should have a row number" do
|
|
32
|
-
expect(@trans2.csv_row_count).to eq("2")
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "should have a to_s of all date description type" do
|
|
36
|
-
expect(@trans1.to_s).to eq("12/01/17 CREDIT SOME TRANSACTION ")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "convert empty strings in money columns to integers" do
|
|
40
|
-
expect(@trans1.moneyout).to eq(0)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "convert empty strings in money columns to integers" do
|
|
44
|
-
expect(@trans2.moneyin).to eq(0)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|