sie 4.0.0 → 4.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12f2a07994c6646b39d43549d25640af5593d05e8ebe93145bbee75d64adc9e5
4
- data.tar.gz: 5401be347bc8c5886678eaa63d027fad9da681d70ea477ba613dd85816d00258
3
+ metadata.gz: 13f115a1741394b88505486a4cc41995e93e0c4e00065c1c2aa1bd428a7b9dd1
4
+ data.tar.gz: f9a4828e5c6acf66b4021b186ee2ec8009ff4eb7ae360195663015e2a92eca0f
5
5
  SHA512:
6
- metadata.gz: 3f913dfe20748fc6dbba3d0486362d43e6c12251e5d6980b906b376295d71f2e34c5e1af19649a43770b55c86f7d890c0755cc3de362ffb889b628ee2bfc00cd
7
- data.tar.gz: d60adfe6ce535b77cf77ccfc923121539e4162743c03a28e9ce877577ce9ebc42de058c0e0d2daa8af0cb12a57ea3843055ffeef808fab636aa41a9348337362
6
+ metadata.gz: 8cc67c2a17bdf79f50d8b26c333e2e486e54685c3478f2034f93ba9137100da650fc8f503cc6905f085abf892999a00f8f799e00fdb98614299209d42b9ce48c
7
+ data.tar.gz: c260f73d18c737c32449c8e9f44cae2d784c77333a9013f86603ee9c9c31e544cbc764d810a30c0e6fecfcb5c8062935cbc726aabdd756dd17451a2cf3cd76e1
@@ -10,7 +10,7 @@ module Sie
10
10
  # - Visma etc -> 100
11
11
  DESCRIPTION_LENGTH_MAX = 100
12
12
 
13
- pattr_initialize :data_source
13
+ pattr_initialize :data_source, [ exclude_balance_rows: false ]
14
14
 
15
15
  def render
16
16
  add_header
@@ -55,6 +55,8 @@ module Sie
55
55
  end
56
56
 
57
57
  def add_balances
58
+ return if exclude_balance_rows
59
+
58
60
  financial_years.each_with_index do |date_range, index|
59
61
  add_balance_rows("IB", -index, balance_account_numbers, date_range.begin)
60
62
  add_balance_rows("UB", -index, balance_account_numbers, date_range.end)
@@ -1,4 +1,4 @@
1
1
  module Sie
2
2
  # For versioning see: http://semver.org/
3
- VERSION = "4.0.0"
3
+ VERSION = "4.1.0"
4
4
  end
@@ -88,8 +88,8 @@ describe Sie::Document, "#render" do
88
88
  end
89
89
  end
90
90
 
91
- let(:doc) {
92
- data_source = TestDataSource.new(
91
+ let(:data_source) {
92
+ TestDataSource.new(
93
93
  accounts: accounts,
94
94
  vouchers: vouchers,
95
95
  program: "Foonomic",
@@ -101,6 +101,9 @@ describe Sie::Document, "#render" do
101
101
  closing_account_numbers: [ 3100, 9999 ],
102
102
  dimensions: dimensions
103
103
  )
104
+ }
105
+
106
+ let(:doc) {
104
107
  Sie::Document.new(data_source)
105
108
  }
106
109
 
@@ -199,6 +202,26 @@ describe Sie::Document, "#render" do
199
202
  )
200
203
  end
201
204
 
205
+ it "excludes balance rows if given the option 'exclude_balance_rows'" do
206
+ document_without_balance_rows = Sie::Document.new(data_source, exclude_balance_rows: true)
207
+ sie_file = Sie::Parser.new.parse(document_without_balance_rows.render)
208
+ expect(sie_file.entries_with_label("ib")).to be_empty
209
+ expect(sie_file.entries_with_label("ub")).to be_empty
210
+ expect(sie_file.entries_with_label("res")).to be_empty
211
+
212
+ document_with_balance_rows = Sie::Document.new(data_source, exclude_balance_rows: false)
213
+ sie_file = Sie::Parser.new.parse(document_with_balance_rows.render)
214
+ expect(sie_file.entries_with_label("ib")).not_to be_empty
215
+ expect(sie_file.entries_with_label("ub")).not_to be_empty
216
+ expect(sie_file.entries_with_label("res")).not_to be_empty
217
+
218
+ document_will_default_with_balance_rows = Sie::Document.new(data_source)
219
+ sie_file = Sie::Parser.new.parse(document_will_default_with_balance_rows.render)
220
+ expect(sie_file.entries_with_label("ib")).not_to be_empty
221
+ expect(sie_file.entries_with_label("ub")).not_to be_empty
222
+ expect(sie_file.entries_with_label("res")).not_to be_empty
223
+ end
224
+
202
225
  context "with really long descriptions" do
203
226
  let(:accounts) {
204
227
  [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sie
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barsoom AB
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attr_extras