keepr 0.4.0 → 0.5.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/.rubocop.yml +44 -0
- data/.travis.yml +9 -9
- data/Gemfile +2 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -3
- data/Rakefile +2 -0
- data/ci/Gemfile-rails-4-2 +3 -2
- data/ci/Gemfile-rails-5-0 +3 -2
- data/ci/Gemfile-rails-5-1 +3 -2
- data/ci/Gemfile-rails-5-2 +3 -2
- data/ci/{Gemfile-rails-4-1 → Gemfile-rails-6-0} +3 -2
- data/keepr.gemspec +14 -12
- data/lib/generators/keepr/migration/migration_generator.rb +5 -3
- data/lib/generators/keepr/migration/templates/migration.rb +2 -0
- data/lib/keepr.rb +6 -4
- data/lib/keepr/account.rb +37 -37
- data/lib/keepr/account_export.rb +10 -14
- data/lib/keepr/active_record_extension.rb +4 -2
- data/lib/keepr/contact_export.rb +6 -7
- data/lib/keepr/cost_center.rb +2 -0
- data/lib/keepr/group.rb +21 -20
- data/lib/keepr/groups_creator.rb +7 -7
- data/lib/keepr/journal.rb +14 -11
- data/lib/keepr/journal_export.rb +9 -6
- data/lib/keepr/posting.rb +21 -16
- data/lib/keepr/tax.rb +2 -0
- data/lib/keepr/version.rb +3 -1
- data/spec/factories/account.rb +5 -3
- data/spec/factories/cost_center.rb +4 -2
- data/spec/factories/group.rb +4 -2
- data/spec/factories/tax.rb +5 -3
- data/spec/keepr/account_export_spec.rb +22 -19
- data/spec/keepr/account_spec.rb +47 -42
- data/spec/keepr/active_record_extension_spec.rb +20 -18
- data/spec/keepr/contact_export_spec.rb +17 -14
- data/spec/keepr/cost_center_spec.rb +2 -0
- data/spec/keepr/group_spec.rb +39 -35
- data/spec/keepr/groups_creator_spec.rb +7 -4
- data/spec/keepr/journal_export_spec.rb +26 -25
- data/spec/keepr/journal_spec.rb +33 -31
- data/spec/keepr/posting_spec.rb +8 -6
- data/spec/keepr/tax_spec.rb +21 -14
- data/spec/spec_helper.rb +6 -5
- data/spec/support/contact.rb +2 -0
- data/spec/support/document.rb +2 -0
- data/spec/support/ledger.rb +2 -0
- data/spec/support/spec_migration.rb +2 -0
- metadata +28 -14
data/spec/keepr/account_spec.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'spec_helper'
|
3
4
|
|
4
5
|
describe Keepr::Account do
|
5
6
|
describe :number_as_string do
|
6
|
-
it
|
7
|
+
it 'should return number with leading zeros for low values' do
|
7
8
|
account = Keepr::Account.new(number: 999)
|
8
9
|
expect(account.number_as_string).to eq('0999')
|
9
10
|
end
|
10
11
|
|
11
|
-
it
|
12
|
-
account = Keepr::Account.new(number:
|
12
|
+
it 'should return number unchanged for high values' do
|
13
|
+
account = Keepr::Account.new(number: 70_000)
|
13
14
|
expect(account.number_as_string).to eq('70000')
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
17
18
|
describe :to_s do
|
18
|
-
it
|
19
|
+
it 'should format' do
|
19
20
|
account = Keepr::Account.new(number: 27, name: 'Software')
|
20
21
|
expect(account.to_s).to eq('0027 (Software)')
|
21
22
|
end
|
@@ -32,25 +33,25 @@ describe Keepr::Account do
|
|
32
33
|
keepr_postings_attributes: [
|
33
34
|
{ keepr_account: account_1000, amount: 20, side: 'debit' },
|
34
35
|
{ keepr_account: account_1200, amount: 20, side: 'credit' }
|
35
|
-
|
36
|
+
]
|
36
37
|
|
37
38
|
Keepr::Journal.create! date: Date.yesterday,
|
38
39
|
keepr_postings_attributes: [
|
39
40
|
{ keepr_account: account_1000, amount: 10, side: 'credit' },
|
40
|
-
{ keepr_account: account_1200, amount: 10, side: 'debit' }
|
41
|
-
|
41
|
+
{ keepr_account: account_1200, amount: 10, side: 'debit' }
|
42
|
+
]
|
42
43
|
|
43
|
-
Keepr::Journal.create! date: Date.
|
44
|
+
Keepr::Journal.create! date: Date.current,
|
44
45
|
keepr_postings_attributes: [
|
45
46
|
{ keepr_account: account_1000, amount: 200, side: 'debit' },
|
46
47
|
{ keepr_account: account_1200, amount: 200, side: 'credit' }
|
47
|
-
|
48
|
+
]
|
48
49
|
|
49
|
-
Keepr::Journal.create! date: Date.
|
50
|
+
Keepr::Journal.create! date: Date.current,
|
50
51
|
keepr_postings_attributes: [
|
51
52
|
{ keepr_account: account_1000, amount: 100, side: 'credit' },
|
52
|
-
{ keepr_account: account_1200, amount: 100, side: 'debit' }
|
53
|
-
|
53
|
+
{ keepr_account: account_1200, amount: 100, side: 'debit' }
|
54
|
+
]
|
54
55
|
end
|
55
56
|
|
56
57
|
describe 'validations' do
|
@@ -58,31 +59,31 @@ describe Keepr::Account do
|
|
58
59
|
let!(:liability_group) { FactoryBot.create(:group, target: :liability) }
|
59
60
|
let!(:asset_group) { FactoryBot.create(:group, target: :asset) }
|
60
61
|
|
61
|
-
it
|
62
|
+
it 'should not allow assigning to result group' do
|
62
63
|
account = FactoryBot.build(:account, keepr_group: result_group)
|
63
64
|
expect(account).to_not be_valid
|
64
|
-
expect(account.errors.added?
|
65
|
+
expect(account.errors.added?(:keepr_group_id, :no_group_allowed_for_result)).to eq(true)
|
65
66
|
end
|
66
67
|
|
67
|
-
it
|
68
|
+
it 'should not allow assigning asset account to liability group' do
|
68
69
|
account = FactoryBot.build(:account, kind: :asset, keepr_group: liability_group)
|
69
70
|
expect(account).to_not be_valid
|
70
|
-
expect(account.errors.added?
|
71
|
+
expect(account.errors.added?(:kind, :group_mismatch)).to eq(true)
|
71
72
|
end
|
72
73
|
|
73
|
-
it
|
74
|
+
it 'should not allow assigning liability account to asset group' do
|
74
75
|
account = FactoryBot.build(:account, kind: :liability, keepr_group: asset_group)
|
75
76
|
expect(account).to_not be_valid
|
76
|
-
expect(account.errors.added?
|
77
|
+
expect(account.errors.added?(:kind, :group_mismatch)).to eq(true)
|
77
78
|
end
|
78
79
|
|
79
|
-
it
|
80
|
+
it 'should not allow assigning forward account to asset group' do
|
80
81
|
account = FactoryBot.build(:account, kind: :forward, keepr_group: asset_group)
|
81
82
|
expect(account).to_not be_valid
|
82
|
-
expect(account.errors.added?
|
83
|
+
expect(account.errors.added?(:kind, :group_conflict)).to eq(true)
|
83
84
|
end
|
84
85
|
|
85
|
-
it
|
86
|
+
it 'should allow target match' do
|
86
87
|
account = FactoryBot.build(:account, kind: :asset, keepr_group: asset_group)
|
87
88
|
expect(account).to be_valid
|
88
89
|
end
|
@@ -176,8 +177,8 @@ end
|
|
176
177
|
|
177
178
|
describe Keepr::Account, 'with subaccounts' do
|
178
179
|
let!(:account_1400) { FactoryBot.create(:account, number: 1400) }
|
179
|
-
let!(:account_10000) { FactoryBot.create(:account, number:
|
180
|
-
let!(:account_10001) { FactoryBot.create(:account, number:
|
180
|
+
let!(:account_10000) { FactoryBot.create(:account, number: 10_000, parent: account_1400) }
|
181
|
+
let!(:account_10001) { FactoryBot.create(:account, number: 10_001, parent: account_1400) }
|
181
182
|
let!(:account_8400) { FactoryBot.create(:account, number: 8400) }
|
182
183
|
|
183
184
|
before :each do
|
@@ -185,7 +186,7 @@ describe Keepr::Account, 'with subaccounts' do
|
|
185
186
|
keepr_postings_attributes: [
|
186
187
|
{ keepr_account: account_10000, amount: 20, side: 'debit' },
|
187
188
|
{ keepr_account: account_8400, amount: 20, side: 'credit' }
|
188
|
-
|
189
|
+
]
|
189
190
|
end
|
190
191
|
|
191
192
|
describe :keepr_postings do
|
@@ -209,34 +210,38 @@ describe Keepr::Account, 'with subaccounts' do
|
|
209
210
|
|
210
211
|
describe :with_sums do
|
211
212
|
it 'should calc balance' do
|
212
|
-
expect(Keepr::Account.with_sums
|
213
|
-
select(&:sum_amount)
|
214
|
-
map { |a| [a.number, a.sum_amount] })
|
215
|
-
|
213
|
+
expect(Keepr::Account.with_sums
|
214
|
+
.select(&:sum_amount)
|
215
|
+
.map { |a| [a.number, a.sum_amount] })
|
216
|
+
.to eq([[8400, -20], [10_000, 20]])
|
216
217
|
end
|
217
218
|
end
|
218
219
|
|
219
220
|
describe :merged_with_sums do
|
220
221
|
it 'should calc merged balance' do
|
221
|
-
expect(Keepr::Account.merged_with_sums
|
222
|
-
select(&:sum_amount)
|
223
|
-
map { |a| [a.number, a.sum_amount] })
|
224
|
-
|
222
|
+
expect(Keepr::Account.merged_with_sums
|
223
|
+
.select(&:sum_amount)
|
224
|
+
.map { |a| [a.number, a.sum_amount] })
|
225
|
+
.to eq([[1400, 20], [8400, -20]])
|
225
226
|
end
|
226
227
|
end
|
227
228
|
end
|
228
229
|
|
229
230
|
describe Keepr::Account, 'with tax' do
|
230
|
-
let!(:tax_account)
|
231
|
-
|
232
|
-
|
231
|
+
let!(:tax_account) do
|
232
|
+
Keepr::Account.create! number: 1776,
|
233
|
+
name: 'Umsatzsteuer 19%',
|
234
|
+
kind: :asset
|
235
|
+
end
|
233
236
|
|
234
|
-
let!(:tax)
|
235
|
-
|
236
|
-
|
237
|
-
|
237
|
+
let!(:tax) do
|
238
|
+
Keepr::Tax.create! name: 'USt19',
|
239
|
+
description: 'Umsatzsteuer 19%',
|
240
|
+
value: 19.0,
|
241
|
+
keepr_account: tax_account
|
242
|
+
end
|
238
243
|
|
239
|
-
it
|
244
|
+
it 'should link to tax' do
|
240
245
|
account = Keepr::Account.new number: 8400,
|
241
246
|
name: 'Erlöse 19% USt',
|
242
247
|
kind: :revenue,
|
@@ -244,7 +249,7 @@ describe Keepr::Account, 'with tax' do
|
|
244
249
|
expect(account).to be_valid
|
245
250
|
end
|
246
251
|
|
247
|
-
it
|
252
|
+
it 'should avoid circular reference' do
|
248
253
|
tax_account.keepr_tax_id = tax.id
|
249
254
|
expect(tax_account).to be_invalid
|
250
255
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Keepr::ActiveRecordExtension do
|
@@ -13,14 +15,14 @@ describe Keepr::ActiveRecordExtension do
|
|
13
15
|
end
|
14
16
|
|
15
17
|
it 'has keepr_postings' do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
Keepr::Journal.create! keepr_postings_attributes: [
|
19
|
+
{ keepr_account: account, amount: 30, side: 'debit' },
|
20
|
+
{ keepr_account: account_1200, amount: 30, side: 'credit' }
|
21
|
+
]
|
22
|
+
Keepr::Journal.create! keepr_postings_attributes: [
|
23
|
+
{ keepr_account: account_1000, amount: 20, side: 'debit' },
|
24
|
+
{ keepr_account: account_1200, amount: 20, side: 'credit' }
|
25
|
+
]
|
24
26
|
|
25
27
|
expect(ledger.keepr_postings.count).to eq(1)
|
26
28
|
expect(ledger.keepr_postings.first.amount).to eq(30)
|
@@ -37,14 +39,14 @@ describe Keepr::ActiveRecordExtension do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
it 'has keepr_postings' do
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
Keepr::Journal.create! keepr_postings_attributes: [
|
43
|
+
{ keepr_account: account1, amount: 30, side: 'debit' },
|
44
|
+
{ keepr_account: account_1200, amount: 30, side: 'credit' }
|
45
|
+
]
|
46
|
+
Keepr::Journal.create! keepr_postings_attributes: [
|
47
|
+
{ keepr_account: account_1000, amount: 20, side: 'debit' },
|
48
|
+
{ keepr_account: account_1200, amount: 20, side: 'credit' }
|
49
|
+
]
|
48
50
|
|
49
51
|
expect(contact.keepr_postings.count).to eq(1)
|
50
52
|
expect(contact.keepr_postings.first.amount).to eq(30)
|
@@ -70,7 +72,7 @@ describe Keepr::ActiveRecordExtension do
|
|
70
72
|
|
71
73
|
describe 'scopes' do
|
72
74
|
let!(:unbooked_document) { Document.create! number: 'Unbooked' }
|
73
|
-
let!(:booked_document)
|
75
|
+
let!(:booked_document) do
|
74
76
|
document = Document.create! number: 'Booked'
|
75
77
|
Keepr::Journal.create! accountable: document,
|
76
78
|
keepr_postings_attributes: [
|
@@ -78,7 +80,7 @@ describe Keepr::ActiveRecordExtension do
|
|
78
80
|
{ keepr_account: account_1200, amount: 100.99, side: 'credit' }
|
79
81
|
]
|
80
82
|
document
|
81
|
-
|
83
|
+
end
|
82
84
|
|
83
85
|
describe :keepr_booked do
|
84
86
|
subject { Document.keepr_booked }
|
@@ -1,22 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Keepr::ContactExport do
|
4
|
-
let!(:account_1000) { FactoryBot.create :account, kind: :asset, number: 1000,
|
5
|
-
let!(:account_10000) { FactoryBot.create :account, kind: :creditor, number:
|
6
|
-
let!(:account_70000) { FactoryBot.create :account, kind: :debtor, number:
|
6
|
+
let!(:account_1000) { FactoryBot.create :account, kind: :asset, number: 1000, name: 'Kasse' }
|
7
|
+
let!(:account_10000) { FactoryBot.create :account, kind: :creditor, number: 10_000, name: 'Meyer GmbH' }
|
8
|
+
let!(:account_70000) { FactoryBot.create :account, kind: :debtor, number: 70_000, name: 'Schulze AG' }
|
7
9
|
|
8
10
|
let(:scope) { Keepr::Account.all }
|
9
11
|
|
10
|
-
let(:export)
|
11
|
-
Keepr::ContactExport.new(
|
12
|
-
|
13
|
-
'
|
14
|
-
'
|
12
|
+
let(:export) do
|
13
|
+
Keepr::ContactExport.new(
|
14
|
+
scope,
|
15
|
+
'Berater' => 1_234_567,
|
16
|
+
'Mandant' => 78_901,
|
17
|
+
'WJ-Beginn' => Date.new(2016, 1, 1),
|
15
18
|
'Bezeichnung' => 'Keepr-Kontakte'
|
16
19
|
) do |account|
|
17
20
|
{ 'Kurzbezeichnung' => account.name }
|
18
21
|
end
|
19
|
-
|
22
|
+
end
|
20
23
|
|
21
24
|
describe :to_s do
|
22
25
|
subject { export.to_s }
|
@@ -25,31 +28,31 @@ describe Keepr::ContactExport do
|
|
25
28
|
subject.lines[2..-1]
|
26
29
|
end
|
27
30
|
|
28
|
-
it
|
31
|
+
it 'should return CSV lines' do
|
29
32
|
subject.lines.each { |line| expect(line).to include(';') }
|
30
33
|
end
|
31
34
|
|
32
|
-
it
|
35
|
+
it 'should include header data' do
|
33
36
|
expect(subject.lines[0]).to include('1234567;')
|
34
37
|
expect(subject.lines[0]).to include('78901;')
|
35
38
|
expect(subject.lines[0]).to include('"Keepr-Kontakte";')
|
36
39
|
end
|
37
40
|
|
38
|
-
it
|
41
|
+
it 'should include debtor/creditor accounts only' do
|
39
42
|
expect(account_lines.count).to eq(2)
|
40
43
|
|
41
44
|
expect(account_lines[0]).to include('10000;')
|
42
45
|
expect(account_lines[1]).to include('70000;')
|
43
46
|
end
|
44
47
|
|
45
|
-
it
|
48
|
+
it 'should include data from block' do
|
46
49
|
expect(account_lines[0]).to include('"Meyer GmbH";')
|
47
50
|
expect(account_lines[1]).to include('"Schulze AG";')
|
48
51
|
end
|
49
52
|
end
|
50
53
|
|
51
54
|
describe :to_file do
|
52
|
-
it
|
55
|
+
it 'should create CSV file' do
|
53
56
|
Dir.mktmpdir do |dir|
|
54
57
|
filename = "#{dir}/EXTF_Stammdaten.csv"
|
55
58
|
export.to_file(filename)
|
data/spec/keepr/group_spec.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Keepr::Group do
|
4
6
|
describe 'validations' do
|
5
|
-
it
|
7
|
+
it 'should allow is_result for liability' do
|
6
8
|
group = Keepr::Group.new(is_result: true, target: :liability, name: 'foo')
|
7
9
|
expect(group).to be_valid
|
8
10
|
end
|
9
11
|
|
10
|
-
[
|
12
|
+
%i[asset profit_and_loss].each do |target|
|
11
13
|
it "should not allow is_result for #{target}" do
|
12
14
|
group = Keepr::Group.new(is_result: true, target: target, name: 'foo')
|
13
15
|
expect(group).not_to be_valid
|
14
|
-
expect(group.errors.added?
|
16
|
+
expect(group.errors.added?(:base, :liability_needed_for_result)).to eq(true)
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -28,9 +30,9 @@ describe Keepr::Group do
|
|
28
30
|
describe :keepr_accounts do
|
29
31
|
it 'should not destroy if there are accounts' do
|
30
32
|
group = FactoryBot.create :group
|
31
|
-
|
33
|
+
FactoryBot.create :account, number: 1000, keepr_group: group
|
32
34
|
|
33
|
-
expect { group.destroy }.to_not change
|
35
|
+
expect { group.destroy }.to_not change(Keepr::Group, :count)
|
34
36
|
expect(group.destroy).to eq(false)
|
35
37
|
expect(group.reload).to eq(group)
|
36
38
|
end
|
@@ -52,7 +54,7 @@ describe Keepr::Group do
|
|
52
54
|
let(:group_2) { FactoryBot.create :group, target: :profit_and_loss }
|
53
55
|
|
54
56
|
# Group for balance result
|
55
|
-
let(:group_result){ FactoryBot.create :group, target: :liability, is_result: true }
|
57
|
+
let(:group_result) { FactoryBot.create :group, target: :liability, is_result: true }
|
56
58
|
|
57
59
|
# Accounts
|
58
60
|
let(:account_1a) { FactoryBot.create :account, number: '0001', keepr_group: group_1_1_1 }
|
@@ -62,40 +64,42 @@ describe Keepr::Group do
|
|
62
64
|
let(:account_2) { FactoryBot.create :account, number: '8400', keepr_group: group_2, kind: :revenue }
|
63
65
|
|
64
66
|
# Journals
|
65
|
-
let!(:journal1)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
67
|
+
let!(:journal1) do
|
68
|
+
Keepr::Journal.create! keepr_postings_attributes: [
|
69
|
+
{ keepr_account: account_1a, amount: 100.99, side: 'debit' },
|
70
|
+
{ keepr_account: account_2, amount: 100.99, side: 'credit' }
|
71
|
+
]
|
72
|
+
end
|
73
|
+
let!(:journal2) do
|
74
|
+
Keepr::Journal.create! keepr_postings_attributes: [
|
75
|
+
{ keepr_account: account_1b, amount: 100.99, side: 'debit' },
|
76
|
+
{ keepr_account: account_2, amount: 100.99, side: 'credit' }
|
77
|
+
]
|
78
|
+
end
|
79
|
+
let!(:journal3) do
|
80
|
+
Keepr::Journal.create! keepr_postings_attributes: [
|
81
|
+
{ keepr_account: account_1c, amount: 100.99, side: 'debit' },
|
82
|
+
{ keepr_account: account_2, amount: 100.99, side: 'credit' }
|
83
|
+
]
|
84
|
+
end
|
80
85
|
|
81
86
|
context 'for normal groups' do
|
82
|
-
it
|
83
|
-
|
84
|
-
expect(group_1.keepr_postings).to eq(
|
85
|
-
expect(group_1_1.keepr_postings).to eq(
|
86
|
-
expect(group_1_1_1.keepr_postings).to eq(
|
87
|
-
|
88
|
-
|
89
|
-
expect(group_2.keepr_postings).to eq(
|
87
|
+
it 'should return postings of all accounts within the group' do
|
88
|
+
postings1 = [journal1.debit_postings.first, journal2.debit_postings.first, journal3.debit_postings.first]
|
89
|
+
expect(group_1.keepr_postings).to eq(postings1)
|
90
|
+
expect(group_1_1.keepr_postings).to eq(postings1)
|
91
|
+
expect(group_1_1_1.keepr_postings).to eq(postings1)
|
92
|
+
|
93
|
+
postings2 = [journal1.credit_postings.first, journal2.credit_postings.first, journal3.credit_postings.first]
|
94
|
+
expect(group_2.keepr_postings).to eq(postings2)
|
90
95
|
end
|
91
96
|
end
|
92
97
|
|
93
|
-
context
|
94
|
-
it
|
95
|
-
result_postings = [
|
96
|
-
|
97
|
-
|
98
|
-
]
|
98
|
+
context 'for result group' do
|
99
|
+
it 'should return postings for P&L accounts' do
|
100
|
+
result_postings = [journal1.credit_postings.first,
|
101
|
+
journal2.credit_postings.first,
|
102
|
+
journal3.credit_postings.first]
|
99
103
|
|
100
104
|
expect(group_result.keepr_postings).to eq(result_postings)
|
101
105
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Keepr::GroupsCreator do
|
@@ -6,7 +8,7 @@ describe Keepr::GroupsCreator do
|
|
6
8
|
Keepr::GroupsCreator.new(:balance).run
|
7
9
|
end
|
8
10
|
|
9
|
-
it
|
11
|
+
it 'should create groups' do
|
10
12
|
expect(Keepr::Group.count).to eq(64)
|
11
13
|
expect(Keepr::Group.asset.count).to eq(36)
|
12
14
|
expect(Keepr::Group.liability.count).to eq(28)
|
@@ -15,7 +17,7 @@ describe Keepr::GroupsCreator do
|
|
15
17
|
compare_with_source(Keepr::Group.liability, 'liability.txt')
|
16
18
|
end
|
17
19
|
|
18
|
-
it
|
20
|
+
it 'should create result group' do
|
19
21
|
expect(Keepr::Group.result).to be_a(Keepr::Group)
|
20
22
|
end
|
21
23
|
end
|
@@ -25,7 +27,7 @@ describe Keepr::GroupsCreator do
|
|
25
27
|
Keepr::GroupsCreator.new(:profit_and_loss).run
|
26
28
|
end
|
27
29
|
|
28
|
-
it
|
30
|
+
it 'should create profit & loss groups' do
|
29
31
|
expect(Keepr::Group.count).to eq(31)
|
30
32
|
expect(Keepr::Group.profit_and_loss.count).to eq(31)
|
31
33
|
|
@@ -33,7 +35,8 @@ describe Keepr::GroupsCreator do
|
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
|
-
private
|
38
|
+
private
|
39
|
+
|
37
40
|
def compare_with_source(scope, filename)
|
38
41
|
full_filename = File.join(File.dirname(__FILE__), "../../lib/keepr/groups_creator/#{filename}")
|
39
42
|
source = File.read(full_filename)
|