norma43_parser 1.0.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE.md +13 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +5 -0
- data/.github/workflows/ci.yml +22 -0
- data/.rubocop.yml +234 -0
- data/CHANGELOG.md +43 -0
- data/Gemfile +7 -1
- data/Gemfile.lock +72 -0
- data/README.md +6 -4
- data/Rakefile +2 -0
- data/lib/norma43/line_handlers.rb +2 -3
- data/lib/norma43/line_parsers/account_end.rb +18 -0
- data/lib/norma43/line_parsers/account_start.rb +18 -0
- data/lib/norma43/line_parsers/additional_currency.rb +12 -0
- data/lib/norma43/line_parsers/additional_item.rb +11 -0
- data/lib/norma43/line_parsers/document_end.rb +9 -0
- data/lib/norma43/line_parsers/document_start.rb +13 -0
- data/lib/norma43/line_parsers/file_format_validator.rb +15 -12
- data/lib/norma43/line_parsers/line_parser.rb +29 -28
- data/lib/norma43/line_parsers/transaction.rb +18 -0
- data/lib/norma43/line_processors.rb +2 -2
- data/lib/norma43/models.rb +5 -4
- data/lib/norma43/parser.rb +38 -42
- data/lib/norma43/utils/contexts.rb +40 -37
- data/lib/norma43/utils/string_helpers.rb +10 -6
- data/lib/norma43/utils/typecaster.rb +16 -12
- data/lib/norma43/version.rb +3 -1
- data/lib/norma43.rb +9 -3
- data/norma43_parser.gemspec +10 -10
- data/spec/example1_parse_spec.rb +12 -11
- data/spec/norma43/line_parsers/account_end_spec.rb +1 -1
- data/spec/norma43/line_parsers/account_start_spec.rb +1 -2
- data/spec/norma43/line_parsers/additional_currency_spec.rb +1 -1
- data/spec/norma43/line_parsers/additional_items_spec.rb +1 -1
- data/spec/norma43/line_parsers/document_end_spec.rb +1 -2
- data/spec/norma43/line_parsers/document_start_spec.rb +1 -1
- data/spec/norma43/line_parsers/transaction_spec.rb +1 -3
- data/spec/norma43/line_processors/account_end_spec.rb +6 -8
- data/spec/norma43/line_processors/account_start_spec.rb +8 -9
- data/spec/norma43/line_processors/additional_currency_spec.rb +6 -7
- data/spec/norma43/line_processors/additional_items_spec.rb +6 -7
- data/spec/norma43/line_processors/document_end_spec.rb +5 -6
- data/spec/norma43/line_processors/document_start_spec.rb +3 -4
- data/spec/norma43/line_processors/transaction_spec.rb +6 -7
- data/spec/norma43/parser_spec.rb +5 -4
- data/spec/norma43_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/support/shared_examples_for_values_line_parsers.rb +2 -0
- metadata +41 -44
- data/lib/norma43/line_parsers/line_parsers.rb +0 -69
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Norma43
|
3
4
|
module LineProcessors
|
4
5
|
DocumentStart = ->(line, contexts) {
|
@@ -55,6 +56,5 @@ module Norma43
|
|
55
56
|
contexts.current.additional_currency = additional_currency
|
56
57
|
contexts
|
57
58
|
}
|
58
|
-
|
59
59
|
end
|
60
60
|
end
|
data/lib/norma43/models.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "virtus"
|
3
4
|
|
4
5
|
module Norma43
|
5
6
|
module Models
|
6
|
-
#forward declarations
|
7
|
+
# forward declarations
|
7
8
|
class Account; end
|
8
9
|
class Transaction; end
|
9
10
|
class AdditionalItem; end
|
@@ -62,7 +63,7 @@ module Norma43
|
|
62
63
|
attribute :reference_2
|
63
64
|
attribute :additional_items, Array[AdditionalItem]
|
64
65
|
attribute :additional_currency, AdditionalCurrency
|
65
|
-
def debit?; self.amount_code==DEBIT_CODE end
|
66
|
+
def debit?; self.amount_code == DEBIT_CODE end
|
66
67
|
end
|
67
68
|
|
68
69
|
class AdditionalItem
|
data/lib/norma43/parser.rb
CHANGED
@@ -1,25 +1,23 @@
|
|
1
|
-
|
2
|
-
require "norma43/line_handlers"
|
3
|
-
require "norma43/utils/contexts"
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
3
|
module Norma43
|
6
|
-
class InvalidFileFormatError < ArgumentError; end
|
4
|
+
class InvalidFileFormatError < ArgumentError; end
|
7
5
|
|
8
6
|
class Parser
|
9
7
|
attr_reader :file
|
10
8
|
|
11
9
|
# Parser.new accepts a File instance or a String
|
12
10
|
# A InvalidFileFormatError will be raised if file isn't in the Norma43 format
|
13
|
-
def initialize
|
11
|
+
def initialize(file)
|
14
12
|
@file = file
|
15
13
|
validator = validate_file_format
|
16
14
|
@contexts = if validator.has_document?
|
17
|
-
Contexts.new
|
15
|
+
Norma43::Utils::Contexts.new
|
18
16
|
else
|
19
17
|
# in theory Norma43 says that files should start with DocumentStart but
|
20
18
|
# practically doesn't happen, so that we create one artificially
|
21
19
|
# to avoid corner cases in the processors
|
22
|
-
Contexts.new().tap { |ctx| ctx.add Models::Document.new }
|
20
|
+
Norma43::Utils::Contexts.new().tap { |ctx| ctx.add Models::Document.new }
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
@@ -28,52 +26,50 @@ module Norma43
|
|
28
26
|
end
|
29
27
|
|
30
28
|
protected
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
29
|
+
def lines
|
30
|
+
@lines ||= file.each_line
|
31
|
+
end
|
35
32
|
|
36
33
|
private
|
34
|
+
def validate_file_format
|
35
|
+
validator = Norma43::LineParsers::FileFormatValidator.new first_line
|
36
|
+
raise InvalidFileFormatError.new(validator.errors.join(", ")) unless validator.valid?
|
37
|
+
validator
|
38
|
+
end
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
raise InvalidFileFormatError.new(validator.errors.join(", ")) unless validator.valid?
|
41
|
-
validator
|
42
|
-
end
|
43
|
-
|
44
|
-
def parse_lines contexts
|
45
|
-
parse_lines parse_line(self.lines.next, contexts)
|
40
|
+
def parse_lines(contexts)
|
41
|
+
parse_lines parse_line(self.lines.next, contexts)
|
46
42
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
rescue StopIteration # because lines is an enumerator raises StopIteration on end
|
44
|
+
self.lines.rewind # Ensure we do not bomb out when calling result multiple times
|
45
|
+
contexts
|
46
|
+
end
|
51
47
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
# Look up a matching handler for the line and process it
|
49
|
+
# The process method on a handler always returns a Contexts object
|
50
|
+
def parse_line(line, contexts)
|
51
|
+
line = line.encode Encoding::UTF_8 if encode_lines?
|
56
52
|
|
57
|
-
|
53
|
+
handler = handler_for_line line
|
58
54
|
|
59
|
-
|
60
|
-
|
55
|
+
handler.process line, contexts
|
56
|
+
end
|
61
57
|
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
def handler_for_line(line)
|
59
|
+
LineHandlers.mapping.fetch line[0..1]
|
60
|
+
end
|
65
61
|
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
def encode_lines?
|
63
|
+
first_line.encoding != Encoding::UTF_8
|
64
|
+
end
|
69
65
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
66
|
+
def first_line
|
67
|
+
@first_line ||= begin
|
68
|
+
line = self.lines.peek
|
69
|
+
self.lines.rewind # peek seems to move the pointer when file is an actual File object
|
74
70
|
|
75
|
-
|
71
|
+
line
|
72
|
+
end
|
76
73
|
end
|
77
|
-
end
|
78
74
|
end
|
79
75
|
end
|
@@ -1,54 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Norma43
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
module Utils
|
5
|
+
class Contexts
|
6
|
+
def initialize(containers = nil)
|
7
|
+
Array(containers).compact.each do |container|
|
8
|
+
add container
|
9
|
+
end
|
6
10
|
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def result
|
10
|
-
contexts.first
|
11
|
-
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def add container
|
18
|
-
contexts.push container
|
19
|
-
end
|
12
|
+
def result
|
13
|
+
contexts.first
|
14
|
+
end
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
def current
|
17
|
+
contexts.last
|
18
|
+
end
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end if contexts.any?
|
29
|
-
end
|
20
|
+
def add(container)
|
21
|
+
contexts.push container
|
22
|
+
end
|
30
23
|
|
31
|
-
|
32
|
-
|
24
|
+
def move_up
|
25
|
+
contexts.pop
|
26
|
+
end
|
33
27
|
|
34
|
-
|
35
|
-
|
28
|
+
def move_to(container_class)
|
29
|
+
until current.is_a?(container_class) || current.nil?
|
30
|
+
move_up
|
31
|
+
end if contexts.any?
|
36
32
|
end
|
37
33
|
|
38
|
-
|
34
|
+
def move_to_or_add_to_parent(container_class, parent_container_class)
|
35
|
+
return self if current.is_a?(container_class)
|
39
36
|
|
40
|
-
|
41
|
-
|
37
|
+
until current.kind_of?(parent_container_class)
|
38
|
+
move_up
|
39
|
+
end
|
42
40
|
|
43
|
-
|
41
|
+
entity = container_class.new
|
44
42
|
|
45
|
-
|
46
|
-
|
43
|
+
setter_name = StringHelpers.underscore container_class.name.split("::").last
|
44
|
+
current.public_send "#{setter_name}=", entity
|
47
45
|
|
48
|
-
|
46
|
+
add entity
|
47
|
+
|
48
|
+
self
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
private
|
52
|
+
def contexts
|
53
|
+
@contexts ||= []
|
54
|
+
end
|
52
55
|
end
|
53
56
|
end
|
54
57
|
end
|
@@ -1,10 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Norma43
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
module Utils
|
5
|
+
module StringHelpers
|
6
|
+
def self.underscore(word)
|
7
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
8
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
9
|
+
word.tr!("-", "_")
|
10
|
+
word.downcase
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
@@ -1,19 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "time"
|
2
4
|
|
3
5
|
module Norma43
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
module Utils
|
7
|
+
module Typecaster
|
8
|
+
def self.cast(value, type)
|
9
|
+
casters.fetch(type).call(value) unless value == ""
|
10
|
+
end
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
def self.casters
|
13
|
+
{
|
14
|
+
integer: ->(value) { value.to_i },
|
15
|
+
time: ->(value) { Time.strptime(value, "%Y%m%d%H%M%S%N") },
|
16
|
+
date: ->(value) { Date.strptime(value, "%y%m%d") },
|
17
|
+
string: ->(value) { value unless value.match?(/\A0+\Z/) },
|
18
|
+
raw: ->(value) { value }
|
19
|
+
}
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
data/lib/norma43/version.rb
CHANGED
data/lib/norma43.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "zeitwerk"
|
4
|
+
|
5
|
+
loader = Zeitwerk::Loader.for_gem
|
6
|
+
loader.setup # ready!
|
3
7
|
|
4
8
|
module Norma43
|
5
|
-
def self.parse
|
9
|
+
def self.parse(text)
|
6
10
|
Parser.new(text).result
|
7
11
|
end
|
8
12
|
end
|
13
|
+
|
14
|
+
loader.eager_load
|
data/norma43_parser.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require "norma43/version"
|
5
6
|
|
@@ -8,20 +9,19 @@ Gem::Specification.new do |spec|
|
|
8
9
|
spec.version = Norma43::VERSION
|
9
10
|
spec.authors = ["Sequra engineering"]
|
10
11
|
spec.email = ["dev@sequra.es"]
|
11
|
-
spec.summary =
|
12
|
+
spec.summary = "Parses banks transactions files specified in rule 43"
|
12
13
|
spec.homepage = "https://github.com/sequra/norma43_parser"
|
13
14
|
spec.license = "MIT"
|
14
15
|
|
15
|
-
spec.required_ruby_version = "
|
16
|
+
spec.required_ruby_version = ">= 2.6"
|
16
17
|
|
17
18
|
spec.files = `git ls-files -z`.split("\x0")
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.
|
23
|
-
spec.
|
24
|
-
|
25
|
-
spec.add_development_dependency "
|
26
|
-
spec.
|
22
|
+
spec.add_runtime_dependency "virtus", "~> 1.0"
|
23
|
+
spec.add_runtime_dependency "zeitwerk", "~> 2.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
27
|
end
|
data/spec/example1_parse_spec.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "norma43"
|
2
4
|
|
3
5
|
RSpec.describe Norma43 do
|
4
6
|
describe "parse" do
|
5
|
-
|
6
7
|
let(:document) do
|
7
|
-
file = File.open(
|
8
|
+
file = File.open(File.join(__dir__, "fixtures/example1.n43"),
|
8
9
|
encoding: "iso-8859-1")
|
9
10
|
Norma43.parse file
|
10
11
|
end
|
@@ -17,7 +18,7 @@ RSpec.describe Norma43 do
|
|
17
18
|
let(:account) { document.accounts.first }
|
18
19
|
|
19
20
|
it "stores expected attributes from AccountStart parser" do
|
20
|
-
expect(account).to have_attributes(
|
21
|
+
expect(account).to have_attributes(
|
21
22
|
"bank_code" => 9999,
|
22
23
|
"branch_code" => 1111,
|
23
24
|
"account_number" => 123456789,
|
@@ -26,18 +27,18 @@ RSpec.describe Norma43 do
|
|
26
27
|
"currency_code" => 1,
|
27
28
|
"information_mode_code" => 3,
|
28
29
|
"abbreviated_name" => "MY ACCOUNT"
|
29
|
-
|
30
|
+
)
|
30
31
|
end
|
31
32
|
|
32
33
|
it "stores expected attributes from AccountEnd parser" do
|
33
|
-
expect(account).to have_attributes(
|
34
|
+
expect(account).to have_attributes(
|
34
35
|
"balance_code" => 2,
|
35
36
|
"balance_amount" => 78889999999999,
|
36
37
|
"debit_entries" => 4,
|
37
38
|
"debit_amount" => 4936,
|
38
39
|
"credit_entries" => 2,
|
39
40
|
"credit_amount" => 999999,
|
40
|
-
|
41
|
+
)
|
41
42
|
end
|
42
43
|
|
43
44
|
describe "transactions" do
|
@@ -48,7 +49,7 @@ RSpec.describe Norma43 do
|
|
48
49
|
describe "first transaction" do
|
49
50
|
let(:transaction) { account.transactions[0] }
|
50
51
|
it "stores expected attributes" do
|
51
|
-
expect(transaction).to have_attributes(
|
52
|
+
expect(transaction).to have_attributes(
|
52
53
|
"origin_branch_code" => 6700,
|
53
54
|
"transaction_date" => Date.parse("2004-04-08"),
|
54
55
|
"value_date" => Date.parse("2004-04-08"),
|
@@ -59,7 +60,7 @@ RSpec.describe Norma43 do
|
|
59
60
|
"document_number" => 0,
|
60
61
|
"reference_1" => 0,
|
61
62
|
"reference_2" => nil,
|
62
|
-
|
63
|
+
)
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
@@ -70,13 +71,13 @@ RSpec.describe Norma43 do
|
|
70
71
|
end
|
71
72
|
|
72
73
|
describe "first additional item" do
|
73
|
-
let(:additional_item) { account.transactions[0].additional_items[0]}
|
74
|
+
let(:additional_item) { account.transactions[0].additional_items[0] }
|
74
75
|
it "stores expected attributes" do
|
75
|
-
expect(additional_item).to have_attributes(
|
76
|
+
expect(additional_item).to have_attributes(
|
76
77
|
"data_code" => 1,
|
77
78
|
"item_1" => "XXXXXXXXX",
|
78
79
|
"item_2" => nil
|
79
|
-
|
80
|
+
)
|
80
81
|
end
|
81
82
|
end
|
82
83
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Norma43
|
4
4
|
module LineParsers
|
@@ -49,7 +49,6 @@ module Norma43
|
|
49
49
|
it "parses the abbreviated name" do
|
50
50
|
expect(account_start.abbreviated_name).to eq "MY ACCOUNT"
|
51
51
|
end
|
52
|
-
|
53
52
|
end
|
54
53
|
end
|
55
54
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Norma43
|
4
4
|
module LineParsers
|
@@ -10,7 +10,6 @@ module Norma43
|
|
10
10
|
it "parses the record number" do
|
11
11
|
expect(document_end.record_number).to eq 48
|
12
12
|
end
|
13
|
-
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Norma43
|
4
4
|
module LineParsers
|
5
5
|
RSpec.describe Transaction do
|
6
6
|
let :transaction do
|
7
|
-
|
8
7
|
Transaction.new "2256781127040805040805020092000000000012340000000000000000000000 REF 2"
|
9
8
|
end
|
10
9
|
|
@@ -52,4 +51,3 @@ module Norma43
|
|
52
51
|
end
|
53
52
|
end
|
54
53
|
end
|
55
|
-
|
@@ -1,19 +1,18 @@
|
|
1
|
-
|
2
|
-
require "norma43/line_processors"
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Norma43
|
5
4
|
module LineProcessors
|
6
|
-
RSpec.describe
|
5
|
+
RSpec.describe AccountEnd do
|
7
6
|
let :line do
|
8
7
|
double "Line", attributes: {}
|
9
8
|
end
|
10
9
|
|
11
|
-
let(:account){ Models::Account.new }
|
12
|
-
let(:contexts){ Contexts.new(
|
10
|
+
let(:account) { Norma43::Models::Account.new }
|
11
|
+
let(:contexts) { Norma43::Utils::Contexts.new(
|
13
12
|
[
|
14
|
-
Models::Document.new,
|
13
|
+
Norma43::Models::Document.new,
|
15
14
|
account,
|
16
|
-
Models::Transaction.new
|
15
|
+
Norma43::Models::Transaction.new
|
17
16
|
])
|
18
17
|
}
|
19
18
|
|
@@ -31,4 +30,3 @@ module Norma43
|
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
34
|
-
|
@@ -1,29 +1,28 @@
|
|
1
|
-
|
2
|
-
require "norma43/line_processors"
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Norma43
|
5
4
|
module LineProcessors
|
6
5
|
RSpec.describe "AccountStart" do
|
7
|
-
let(:line){ double "Line", attributes: {} }
|
8
|
-
let(:document) { Models::Document.new }
|
9
|
-
let(:contexts){ Contexts.new}
|
6
|
+
let(:line) { double "Line", attributes: {} }
|
7
|
+
let(:document) { Norma43::Models::Document.new }
|
8
|
+
let(:contexts) { Norma43::Utils::Contexts.new }
|
10
9
|
|
11
10
|
before do
|
12
11
|
contexts.add document
|
13
12
|
end
|
14
13
|
|
15
14
|
it "instantiates a new account with the line attributes" do
|
16
|
-
allow(Models::Account).to receive :new
|
15
|
+
allow(Norma43::Models::Account).to receive :new
|
17
16
|
|
18
17
|
AccountStart.call line, contexts
|
19
18
|
|
20
|
-
expect(Models::Account).to have_received(:new).with line.attributes
|
19
|
+
expect(Norma43::Models::Account).to have_received(:new).with line.attributes
|
21
20
|
end
|
22
21
|
|
23
22
|
context "when AccountStart is called" do
|
24
|
-
let(:fake_account) { double "Models::Account" }
|
23
|
+
let(:fake_account) { double "Norma43::Models::Account" }
|
25
24
|
before do
|
26
|
-
allow(Models::Account).to receive(:new) { fake_account }
|
25
|
+
allow(Norma43::Models::Account).to receive(:new) { fake_account }
|
27
26
|
end
|
28
27
|
let!(:subject) { AccountStart.call line, contexts }
|
29
28
|
|
@@ -1,15 +1,14 @@
|
|
1
|
-
|
2
|
-
require "norma43/line_processors"
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Norma43
|
5
4
|
module LineProcessors
|
6
5
|
RSpec.describe "AdditionalCurrency" do
|
7
|
-
let(:line){ double "Line", attributes: {} }
|
8
|
-
let(:transaction){ Models::Transaction.new }
|
9
|
-
let(:contexts){ Contexts.new(
|
6
|
+
let(:line) { double "Line", attributes: {} }
|
7
|
+
let(:transaction) { Norma43::Models::Transaction.new }
|
8
|
+
let(:contexts) { Norma43::Utils::Contexts.new(
|
10
9
|
[
|
11
|
-
Models::Document.new
|
12
|
-
Models::Account.new
|
10
|
+
Norma43::Models::Document.new,
|
11
|
+
Norma43::Models::Account.new,
|
13
12
|
transaction
|
14
13
|
])
|
15
14
|
}
|
@@ -1,15 +1,14 @@
|
|
1
|
-
|
2
|
-
require "norma43/line_processors"
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Norma43
|
5
4
|
module LineProcessors
|
6
5
|
RSpec.describe "AdditionalItems" do
|
7
|
-
let(:line){ double "Line", attributes: {} }
|
8
|
-
let(:transaction){ Models::Transaction.new }
|
9
|
-
let(:contexts){ Contexts.new(
|
6
|
+
let(:line) { double "Line", attributes: {} }
|
7
|
+
let(:transaction) { Norma43::Models::Transaction.new }
|
8
|
+
let(:contexts) { Norma43::Utils::Contexts.new(
|
10
9
|
[
|
11
|
-
Models::Document.new
|
12
|
-
Models::Account.new
|
10
|
+
Norma43::Models::Document.new,
|
11
|
+
Norma43::Models::Account.new,
|
13
12
|
transaction
|
14
13
|
])
|
15
14
|
}
|