ibandit 0.11.6 → 0.11.7

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.
@@ -18,7 +18,7 @@ module Ibandit
18
18
  Constants::PSEUDO_IBAN_CHECK_DIGITS,
19
19
  padded_bank_code,
20
20
  padded_branch_code,
21
- padded_account_number
21
+ padded_account_number,
22
22
  ].join
23
23
  end
24
24
 
@@ -67,7 +67,7 @@ module Ibandit
67
67
 
68
68
  def pad(number, length_key)
69
69
  return if number.nil?
70
- number.rjust(structure[length_key], 'X')
70
+ number.rjust(structure[length_key], "X")
71
71
  end
72
72
 
73
73
  def structure
@@ -5,45 +5,48 @@ module Ibandit
5
5
  end
6
6
 
7
7
  def split
8
- return unless decomposable?
9
-
10
8
  {
11
9
  country_code: country_code,
10
+ check_digits: check_digits,
12
11
  bank_code: bank_code,
13
12
  branch_code: branch_code,
14
- account_number: account_number
13
+ account_number: account_number,
15
14
  }
16
15
  end
17
16
 
18
- private
19
-
20
17
  def country_code
21
18
  @pseudo_iban.slice(0, 2)
22
19
  end
23
20
 
21
+ private
22
+
24
23
  def check_digits
25
24
  @pseudo_iban.slice(2, 2)
26
25
  end
27
26
 
28
27
  def bank_code
28
+ return unless country_code_valid?
29
29
  pseudo_iban_part(bank_code_start_index, :pseudo_iban_bank_code_length)
30
30
  end
31
31
 
32
32
  def branch_code
33
+ return unless country_code_valid?
33
34
  pseudo_iban_part(branch_code_start_index,
34
35
  :pseudo_iban_branch_code_length)
35
36
  end
36
37
 
37
38
  def account_number
38
- pseudo_iban_part(account_number_start_index,
39
- :pseudo_iban_account_number_length)
39
+ return unless country_code_valid?
40
+ remove_leading_padding(
41
+ @pseudo_iban.slice(account_number_start_index, @pseudo_iban.length),
42
+ )
40
43
  end
41
44
 
42
45
  def pseudo_iban_part(start_index, length_key)
43
46
  length = structure.fetch(length_key)
44
47
  return if length == 0
45
48
 
46
- @pseudo_iban.slice(start_index, length).gsub(/\AX+/, '')
49
+ remove_leading_padding(@pseudo_iban.slice(start_index, length))
47
50
  end
48
51
 
49
52
  def bank_code_start_index
@@ -58,29 +61,16 @@ module Ibandit
58
61
  branch_code_start_index + structure.fetch(:pseudo_iban_branch_code_length)
59
62
  end
60
63
 
61
- def expected_length
62
- account_number_start_index +
63
- structure.fetch(:pseudo_iban_account_number_length)
64
- end
65
-
66
- def decomposable?
67
- country_code_valid? && check_digits_valid? && correct_length?
68
- end
69
-
70
64
  def country_code_valid?
71
65
  Constants::PSEUDO_IBAN_COUNTRY_CODES.include?(country_code)
72
66
  end
73
67
 
74
- def check_digits_valid?
75
- check_digits == Constants::PSEUDO_IBAN_CHECK_DIGITS
76
- end
77
-
78
- def correct_length?
79
- @pseudo_iban.length == expected_length
80
- end
81
-
82
68
  def structure
83
69
  Ibandit.structures[country_code]
84
70
  end
71
+
72
+ def remove_leading_padding(input)
73
+ input.gsub(/\AX+/, "")
74
+ end
85
75
  end
86
76
  end
@@ -13,7 +13,7 @@ module Ibandit
13
13
  def self.bank_info_table
14
14
  @swedish_bank_lookup ||=
15
15
  begin
16
- relative_path = '../../../../data/raw/swedish_bank_lookup.yml'
16
+ relative_path = "../../../../data/raw/swedish_bank_lookup.yml"
17
17
  raw_info = YAML.load_file(File.expand_path(relative_path, __FILE__))
18
18
 
19
19
  raw_info.map { |bank| bank.merge(range: Range.new(*bank[:range])) }
@@ -19,14 +19,14 @@ module Ibandit
19
19
  def convert
20
20
  if bank_info.nil?
21
21
  return { swift_bank_code: nil,
22
- swift_account_number: cleaned_account_number.rjust(17, '0') }
22
+ swift_account_number: cleaned_account_number.rjust(17, "0") }
23
23
  end
24
24
 
25
25
  {
26
26
  account_number: serial_number,
27
27
  branch_code: clearing_code,
28
28
  swift_bank_code: bank_info.fetch(:bank_code).to_s,
29
- swift_account_number: swift_account_number
29
+ swift_account_number: swift_account_number,
30
30
  }
31
31
  end
32
32
 
@@ -44,7 +44,7 @@ module Ibandit
44
44
 
45
45
  def remove_bad_chars(number)
46
46
  return if number.nil?
47
- number.gsub(/[-.\s]/, '')
47
+ number.gsub(/[-.\s]/, "")
48
48
  end
49
49
 
50
50
  def bank_info
@@ -76,15 +76,15 @@ module Ibandit
76
76
  end
77
77
 
78
78
  return serial_number unless bank_info.fetch(:zerofill_serial_number)
79
- serial_number && serial_number.rjust(serial_number_length, '0')
79
+ serial_number && serial_number.rjust(serial_number_length, "0")
80
80
  end
81
81
 
82
82
  def swift_account_number
83
83
  if bank_info.fetch(:include_clearing_code) &&
84
- clearing_code && serial_number
85
- (clearing_code + serial_number).rjust(17, '0')
84
+ clearing_code && serial_number
85
+ (clearing_code + serial_number).rjust(17, "0")
86
86
  else
87
- serial_number && serial_number.rjust(17, '0')
87
+ serial_number && serial_number.rjust(17, "0")
88
88
  end
89
89
  end
90
90
  end
@@ -25,7 +25,7 @@ module Ibandit
25
25
  serial_number_length = bank_info.fetch(:serial_number_length)
26
26
 
27
27
  if bank_info.fetch(:zerofill_serial_number)
28
- serial_number = serial_number.rjust(serial_number_length, '0')
28
+ serial_number = serial_number.rjust(serial_number_length, "0")
29
29
  end
30
30
 
31
31
  serial_number_length == serial_number.to_s.length
@@ -43,7 +43,7 @@ module Ibandit
43
43
  account_number: nil)
44
44
  return unless bank_code_exists?(bank_code)
45
45
 
46
- clearing_code = account_number.gsub(/\A0+/, '').slice(0, 4).to_i
46
+ clearing_code = account_number.gsub(/\A0+/, "").slice(0, 4).to_i
47
47
  Sweden::BankLookup.for_bank_code(bank_code).any? do |bank|
48
48
  !bank[:include_clearing_code] || bank[:range].include?(clearing_code)
49
49
  end
@@ -53,7 +53,7 @@ module Ibandit
53
53
  account_number: nil)
54
54
  bank_code_possible = bank_code_possible_for_account_number?(
55
55
  bank_code: bank_code,
56
- account_number: account_number
56
+ account_number: account_number,
57
57
  )
58
58
  return unless bank_code_possible
59
59
 
@@ -61,11 +61,11 @@ module Ibandit
61
61
  length = bank.fetch(:serial_number_length)
62
62
  length += bank[:clearing_code_length] if bank[:include_clearing_code]
63
63
 
64
- cleaned_account_number = account_number.gsub(/\A0+/, '')
64
+ cleaned_account_number = account_number.gsub(/\A0+/, "")
65
65
  if bank[:zerofill_serial_number] && !bank[:include_clearing_code]
66
66
  cleaned_account_number =
67
67
  cleaned_account_number.
68
- rjust(bank.fetch(:serial_number_length), '0')
68
+ rjust(bank.fetch(:serial_number_length), "0")
69
69
  end
70
70
 
71
71
  cleaned_account_number.length == length
@@ -1,3 +1,3 @@
1
1
  module Ibandit
2
- VERSION = '0.11.6'.freeze
2
+ VERSION = "0.11.7".freeze
3
3
  end
@@ -1,7 +1,7 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Ibandit::GermanDetailsConverter do
4
- shared_examples 'json based fixture' do |json_fixture_file|
4
+ shared_examples "json based fixture" do |json_fixture_file|
5
5
  json_fixture(json_fixture_file).each do |convertor|
6
6
  context "Rule #{convertor['convertor']}" do
7
7
  let(:klass) do
@@ -15,35 +15,36 @@ describe Ibandit::GermanDetailsConverter do
15
15
  and_call_original
16
16
  end
17
17
 
18
- convertor.fetch('valid', []).each do |tuple|
18
+ convertor.fetch("valid", []).each do |tuple|
19
19
  context "bank code: #{tuple['bank_code']} account number " \
20
20
  "#{tuple['account_number']}" do
21
21
  let(:bank_code) do
22
- tuple['bank_code']
22
+ tuple["bank_code"]
23
23
  end
24
24
  let(:account_number) do
25
- tuple['account_number']
25
+ tuple["account_number"]
26
26
  end
27
27
  let(:converted_bank_code) do
28
- tuple['converted_bank_code'] || bank_code
28
+ tuple["converted_bank_code"] || bank_code
29
29
  end
30
30
  let(:converted_account_number) do
31
- tuple['converted_account_number'] || account_number
31
+ tuple["converted_account_number"] || account_number
32
32
  end
33
33
  it do
34
34
  is_expected.to eq(
35
35
  bank_code: converted_bank_code,
36
- account_number: converted_account_number)
36
+ account_number: converted_account_number,
37
+ )
37
38
  end
38
39
  end
39
40
  end
40
41
 
41
- convertor.fetch('invalid', []).each do |tuple|
42
+ convertor.fetch("invalid", []).each do |tuple|
42
43
  context "bank code: #{tuple['bank_code']} account number " \
43
44
  "#{tuple['account_number']}" do
44
- let(:bank_code) { tuple['bank_code'] || '00000000' }
45
- let(:account_number) { tuple['account_number'] }
46
- it 'raises UnsupportedAccountDetails' do
45
+ let(:bank_code) { tuple["bank_code"] || "00000000" }
46
+ let(:account_number) { tuple["account_number"] }
47
+ it "raises UnsupportedAccountDetails" do
47
48
  expect { subject }.
48
49
  to raise_error(Ibandit::UnsupportedAccountDetails)
49
50
  end
@@ -53,8 +54,8 @@ describe Ibandit::GermanDetailsConverter do
53
54
  end
54
55
  end
55
56
 
56
- describe 'integration tests' do
57
- include_examples 'json based fixture', 'germany_integration_test_cases' do
57
+ describe "integration tests" do
58
+ include_examples "json based fixture", "germany_integration_test_cases" do
58
59
  let(:test_subject) do
59
60
  described_class.
60
61
  convert(bank_code: bank_code, account_number: account_number)
@@ -62,8 +63,8 @@ describe Ibandit::GermanDetailsConverter do
62
63
  end
63
64
  end
64
65
 
65
- describe 'unit tests' do
66
- include_examples 'json based fixture', 'germany_unit_test_cases' do
66
+ describe "unit tests" do
67
+ include_examples "json based fixture", "germany_unit_test_cases" do
67
68
  let(:test_subject) do
68
69
  klass.new(bank_code, account_number).converted_details
69
70
  end
@@ -74,25 +75,25 @@ describe Ibandit::GermanDetailsConverter do
74
75
  subject { described_class.new(account_number) }
75
76
 
76
77
  # Test cases taken from the IBAN Rules definitions document
77
- valid_account_numbers = %w(
78
+ valid_account_numbers = %w[
78
79
  38150900 600103660 39101181 5600200 75269100 3700246 6723143
79
80
  5719083 571908300 8007759 800775900 350002200 900004300
80
- )
81
+ ]
81
82
 
82
- invalid_account_numbers = %w(
83
+ invalid_account_numbers = %w[
83
84
  370024600 672314300 3500022 9000043 123456700 94012341 94012341
84
85
  5073321010 1234517892 987614325
85
- )
86
+ ]
86
87
 
87
88
  valid_account_numbers.each do |number|
88
- context "#{number}" do
89
+ context number.to_s do
89
90
  let(:account_number) { number }
90
91
  it { is_expected.to be_valid }
91
92
  end
92
93
  end
93
94
 
94
95
  invalid_account_numbers.each do |number|
95
- context "#{number}" do
96
+ context number.to_s do
96
97
  let(:account_number) { number }
97
98
  it { is_expected.to_not be_valid }
98
99
  end
@@ -1,901 +1,901 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Ibandit::IBANAssembler do
4
- shared_examples_for 'allows round trips' do |iban_code|
4
+ shared_examples_for "allows round trips" do |iban_code|
5
5
  let(:iban) { Ibandit::IBAN.new(iban_code) }
6
6
  let(:args) do
7
7
  {
8
8
  country_code: iban.country_code,
9
9
  account_number: iban.swift_account_number,
10
10
  branch_code: iban.swift_branch_code,
11
- bank_code: iban.swift_bank_code
11
+ bank_code: iban.swift_bank_code,
12
12
  }.reject { |_key, value| value.nil? }
13
13
  end
14
14
 
15
- it 'successfully reconstructs the IBAN' do
15
+ it "successfully reconstructs the IBAN" do
16
16
  expect(described_class.assemble(args)).to eq(iban.iban)
17
17
  end
18
18
  end
19
19
 
20
- describe '.assemble' do
20
+ describe ".assemble" do
21
21
  subject(:assemble) { described_class.assemble(args) }
22
- let(:args) { { country_code: 'ES' } }
22
+ let(:args) { { country_code: "ES" } }
23
23
 
24
- context 'without a country_code' do
24
+ context "without a country_code" do
25
25
  let(:args) { { bank_code: 1 } }
26
26
  it { is_expected.to be_nil }
27
27
  end
28
28
 
29
- context 'with an unsupported country_code' do
30
- let(:args) { { country_code: 'FU' } }
29
+ context "with an unsupported country_code" do
30
+ let(:args) { { country_code: "FU" } }
31
31
  it { is_expected.to be_nil }
32
32
  end
33
33
 
34
- context 'with AT as the country_code' do
34
+ context "with AT as the country_code" do
35
35
  let(:args) do
36
36
  {
37
- country_code: 'AT',
38
- account_number: '00234573201',
39
- bank_code: '19043'
37
+ country_code: "AT",
38
+ account_number: "00234573201",
39
+ bank_code: "19043",
40
40
  }
41
41
  end
42
42
 
43
- it { is_expected.to eq('AT611904300234573201') }
43
+ it { is_expected.to eq("AT611904300234573201") }
44
44
 
45
- it_behaves_like 'allows round trips', 'AT61 1904 3002 3457 3201'
45
+ it_behaves_like "allows round trips", "AT61 1904 3002 3457 3201"
46
46
 
47
- context 'without an account_number' do
47
+ context "without an account_number" do
48
48
  before { args.delete(:account_number) }
49
49
  it { is_expected.to be_nil }
50
50
  end
51
51
 
52
- context 'without an bank_code' do
52
+ context "without an bank_code" do
53
53
  before { args.delete(:bank_code) }
54
54
  it { is_expected.to be_nil }
55
55
  end
56
56
  end
57
57
 
58
- context 'with BE as the country_code' do
59
- let(:args) { { country_code: 'BE', account_number: '510007547061' } }
58
+ context "with BE as the country_code" do
59
+ let(:args) { { country_code: "BE", account_number: "510007547061" } }
60
60
 
61
- it { is_expected.to eq('BE62510007547061') }
61
+ it { is_expected.to eq("BE62510007547061") }
62
62
 
63
- it_behaves_like 'allows round trips', 'BE62 5100 0754 7061'
63
+ it_behaves_like "allows round trips", "BE62 5100 0754 7061"
64
64
 
65
- context 'without an account_number' do
65
+ context "without an account_number" do
66
66
  before { args.delete(:account_number) }
67
67
  it { is_expected.to be_nil }
68
68
  end
69
69
  end
70
70
 
71
- context 'with BG as the country_code' do
71
+ context "with BG as the country_code" do
72
72
  let(:args) do
73
73
  {
74
- country_code: 'BG',
75
- account_number: '1020345678',
76
- bank_code: 'BNBG',
77
- branch_code: '9661'
74
+ country_code: "BG",
75
+ account_number: "1020345678",
76
+ bank_code: "BNBG",
77
+ branch_code: "9661",
78
78
  }
79
79
  end
80
80
 
81
- it { is_expected.to eq('BG80BNBG96611020345678') }
81
+ it { is_expected.to eq("BG80BNBG96611020345678") }
82
82
 
83
- it_behaves_like 'allows round trips', 'BG80 BNBG 9661 1020 3456 78'
83
+ it_behaves_like "allows round trips", "BG80 BNBG 9661 1020 3456 78"
84
84
 
85
- context 'without an account_number' do
85
+ context "without an account_number" do
86
86
  before { args.delete(:account_number) }
87
87
  it { is_expected.to be_nil }
88
88
  end
89
89
 
90
- context 'without a bank_code' do
90
+ context "without a bank_code" do
91
91
  before { args.delete(:bank_code) }
92
92
  it { is_expected.to be_nil }
93
93
  end
94
94
  end
95
95
 
96
- context 'with CY as the country_code' do
96
+ context "with CY as the country_code" do
97
97
  let(:args) do
98
98
  {
99
- country_code: 'CY',
100
- account_number: '0000001200527600',
101
- bank_code: '002',
102
- branch_code: '00128'
99
+ country_code: "CY",
100
+ account_number: "0000001200527600",
101
+ bank_code: "002",
102
+ branch_code: "00128",
103
103
  }
104
104
  end
105
105
 
106
- it { is_expected.to eq('CY17002001280000001200527600') }
106
+ it { is_expected.to eq("CY17002001280000001200527600") }
107
107
 
108
- it_behaves_like 'allows round trips', 'CY17 0020 0128 0000 0012 0052 7600'
108
+ it_behaves_like "allows round trips", "CY17 0020 0128 0000 0012 0052 7600"
109
109
 
110
- context 'without an branch_code' do
110
+ context "without an branch_code" do
111
111
  before { args.delete(:branch_code) }
112
- it { is_expected.to eq('CY040020000001200527600') }
112
+ it { is_expected.to eq("CY040020000001200527600") }
113
113
  end
114
114
 
115
- context 'without an account_number' do
115
+ context "without an account_number" do
116
116
  before { args.delete(:account_number) }
117
117
  it { is_expected.to be_nil }
118
118
  end
119
119
 
120
- context 'without an bank_code' do
120
+ context "without an bank_code" do
121
121
  before { args.delete(:bank_code) }
122
122
  it { is_expected.to be_nil }
123
123
  end
124
124
  end
125
125
 
126
- context 'with CZ as the country_code' do
126
+ context "with CZ as the country_code" do
127
127
  let(:args) do
128
128
  {
129
- country_code: 'CZ',
130
- bank_code: '0800',
131
- account_number: '0000192000145399'
129
+ country_code: "CZ",
130
+ bank_code: "0800",
131
+ account_number: "0000192000145399",
132
132
  }
133
133
  end
134
134
 
135
- it { is_expected.to eq('CZ6508000000192000145399') }
135
+ it { is_expected.to eq("CZ6508000000192000145399") }
136
136
 
137
- it_behaves_like 'allows round trips', 'CZ65 0800 0000 1920 0014 5399'
137
+ it_behaves_like "allows round trips", "CZ65 0800 0000 1920 0014 5399"
138
138
 
139
- context 'without a bank_code' do
139
+ context "without a bank_code" do
140
140
  before { args.delete(:bank_code) }
141
141
  it { is_expected.to be_nil }
142
142
  end
143
143
 
144
- context 'without an account_number' do
144
+ context "without an account_number" do
145
145
  before { args.delete(:account_number) }
146
146
  it { is_expected.to be_nil }
147
147
  end
148
148
  end
149
149
 
150
- context 'with DE as the country_code' do
150
+ context "with DE as the country_code" do
151
151
  let(:args) do
152
- { country_code: 'DE',
153
- bank_code: '37040044',
154
- account_number: '0532013000' }
152
+ { country_code: "DE",
153
+ bank_code: "37040044",
154
+ account_number: "0532013000" }
155
155
  end
156
156
 
157
- it { is_expected.to eq('DE89370400440532013000') }
157
+ it { is_expected.to eq("DE89370400440532013000") }
158
158
 
159
- it_behaves_like 'allows round trips', 'DE89 3704 0044 0532 0130 00'
159
+ it_behaves_like "allows round trips", "DE89 3704 0044 0532 0130 00"
160
160
 
161
- context 'without a bank_code' do
161
+ context "without a bank_code" do
162
162
  before { args.delete(:bank_code) }
163
163
  it { is_expected.to be_nil }
164
164
  end
165
165
 
166
- context 'without an account_number' do
166
+ context "without an account_number" do
167
167
  before { args.delete(:account_number) }
168
168
  it { is_expected.to be_nil }
169
169
  end
170
170
  end
171
171
 
172
- context 'with DK as the country_code' do
172
+ context "with DK as the country_code" do
173
173
  let(:args) do
174
- { country_code: 'DK',
175
- bank_code: '1199',
176
- account_number: '0003179680' }
174
+ { country_code: "DK",
175
+ bank_code: "1199",
176
+ account_number: "0003179680" }
177
177
  end
178
178
 
179
- it { is_expected.to eq('DK2411990003179680') }
179
+ it { is_expected.to eq("DK2411990003179680") }
180
180
 
181
- it_behaves_like 'allows round trips', 'DK24 1199 0003 1796 80'
181
+ it_behaves_like "allows round trips", "DK24 1199 0003 1796 80"
182
182
 
183
- context 'without a bank_code' do
183
+ context "without a bank_code" do
184
184
  before { args.delete(:bank_code) }
185
185
  it { is_expected.to be_nil }
186
186
  end
187
187
 
188
- context 'without an account_number' do
188
+ context "without an account_number" do
189
189
  before { args.delete(:account_number) }
190
190
  it { is_expected.to be_nil }
191
191
  end
192
192
  end
193
193
 
194
- context 'with EE as the country_code' do
194
+ context "with EE as the country_code" do
195
195
  let(:args) do
196
196
  {
197
- country_code: 'EE',
198
- bank_code: '22',
199
- account_number: '00221020145685'
197
+ country_code: "EE",
198
+ bank_code: "22",
199
+ account_number: "00221020145685",
200
200
  }
201
201
  end
202
202
 
203
- it { is_expected.to eq('EE382200221020145685') }
203
+ it { is_expected.to eq("EE382200221020145685") }
204
204
 
205
- it_behaves_like 'allows round trips', 'EE38 2200 2210 2014 5685'
205
+ it_behaves_like "allows round trips", "EE38 2200 2210 2014 5685"
206
206
 
207
- context 'without an account_number' do
207
+ context "without an account_number" do
208
208
  before { args.delete(:account_number) }
209
209
  it { is_expected.to be_nil }
210
210
  end
211
211
  end
212
212
 
213
- context 'with ES as the country_code' do
213
+ context "with ES as the country_code" do
214
214
  let(:args) do
215
215
  {
216
- country_code: 'ES',
217
- bank_code: '2310',
218
- branch_code: '0001',
219
- account_number: '180000012345'
216
+ country_code: "ES",
217
+ bank_code: "2310",
218
+ branch_code: "0001",
219
+ account_number: "180000012345",
220
220
  }
221
221
  end
222
222
 
223
- it { is_expected.to eq('ES8023100001180000012345') }
223
+ it { is_expected.to eq("ES8023100001180000012345") }
224
224
 
225
- it_behaves_like 'allows round trips', 'ES80 2310 0001 1800 0001 2345'
225
+ it_behaves_like "allows round trips", "ES80 2310 0001 1800 0001 2345"
226
226
 
227
- context 'without a bank_code or branch code' do
227
+ context "without a bank_code or branch code" do
228
228
  before { args.delete(:bank_code) }
229
229
  before { args.delete(:branch_code) }
230
- before { args[:account_number] = '23100001180000012345' }
230
+ before { args[:account_number] = "23100001180000012345" }
231
231
 
232
232
  it { is_expected.to be_nil }
233
233
  end
234
234
 
235
- context 'without an account_number' do
235
+ context "without an account_number" do
236
236
  before { args.delete(:account_number) }
237
237
  it { is_expected.to be_nil }
238
238
  end
239
239
  end
240
240
 
241
- context 'with FI as the country_code' do
241
+ context "with FI as the country_code" do
242
242
  let(:args) do
243
- { country_code: 'FI', bank_code: '123456', account_number: '00000785' }
243
+ { country_code: "FI", bank_code: "123456", account_number: "00000785" }
244
244
  end
245
245
 
246
- it { is_expected.to eq('FI2112345600000785') }
246
+ it { is_expected.to eq("FI2112345600000785") }
247
247
 
248
- it_behaves_like 'allows round trips', 'FI21 1234 5600 0007 85'
248
+ it_behaves_like "allows round trips", "FI21 1234 5600 0007 85"
249
249
 
250
- context 'without an account_number' do
250
+ context "without an account_number" do
251
251
  before { args.delete(:account_number) }
252
252
  it { is_expected.to be_nil }
253
253
  end
254
254
 
255
- context 'without a bank_code' do
255
+ context "without a bank_code" do
256
256
  before { args.delete(:bank_code) }
257
257
  it { is_expected.to be_nil }
258
258
  end
259
259
  end
260
260
 
261
- context 'with FR as the country_code' do
261
+ context "with FR as the country_code" do
262
262
  let(:args) do
263
263
  {
264
- country_code: 'FR',
265
- bank_code: '20041',
266
- branch_code: '01005',
267
- account_number: '0500013M02606'
264
+ country_code: "FR",
265
+ bank_code: "20041",
266
+ branch_code: "01005",
267
+ account_number: "0500013M02606",
268
268
  }
269
269
  end
270
270
 
271
- it { is_expected.to eq('FR1420041010050500013M02606') }
271
+ it { is_expected.to eq("FR1420041010050500013M02606") }
272
272
 
273
- it_behaves_like 'allows round trips', 'FR14 2004 1010 0505 0001 3M02 606'
273
+ it_behaves_like "allows round trips", "FR14 2004 1010 0505 0001 3M02 606"
274
274
 
275
- context 'without the rib key in the account number' do
276
- before { args[:account_number] = '0500013M026' }
275
+ context "without the rib key in the account number" do
276
+ before { args[:account_number] = "0500013M026" }
277
277
  specify { expect(Ibandit::IBAN.new(assemble)).to_not be_valid }
278
278
  end
279
279
 
280
- context 'without a bank_code' do
280
+ context "without a bank_code" do
281
281
  before { args.delete(:bank_code) }
282
282
  it { is_expected.to be_nil }
283
283
  end
284
284
 
285
- context 'without a branch_code' do
285
+ context "without a branch_code" do
286
286
  before { args.delete(:branch_code) }
287
287
  it { is_expected.to be_nil }
288
288
  end
289
289
 
290
- context 'without an account_number' do
290
+ context "without an account_number" do
291
291
  before { args.delete(:account_number) }
292
292
  it { is_expected.to be_nil }
293
293
  end
294
294
  end
295
295
 
296
- context 'with GB as the country_code' do
296
+ context "with GB as the country_code" do
297
297
  let(:args) do
298
298
  {
299
- country_code: 'GB',
300
- bank_code: 'BARC',
301
- branch_code: '200000',
302
- account_number: '00579135'
299
+ country_code: "GB",
300
+ bank_code: "BARC",
301
+ branch_code: "200000",
302
+ account_number: "00579135",
303
303
  }
304
304
  end
305
305
 
306
- it { is_expected.to eq('GB07BARC20000000579135') }
306
+ it { is_expected.to eq("GB07BARC20000000579135") }
307
307
 
308
- it_behaves_like 'allows round trips', 'GB07 BARC 2000 0000 5791 35'
308
+ it_behaves_like "allows round trips", "GB07 BARC 2000 0000 5791 35"
309
309
 
310
- context 'with the bank_code supplied manually' do
311
- before { args.merge!(bank_code: 'BARC') }
312
- it { is_expected.to eq('GB07BARC20000000579135') }
310
+ context "with the bank_code supplied manually" do
311
+ before { args.merge!(bank_code: "BARC") }
312
+ it { is_expected.to eq("GB07BARC20000000579135") }
313
313
  end
314
314
 
315
- context 'without a branch_code' do
315
+ context "without a branch_code" do
316
316
  before { args.delete(:branch_code) }
317
317
  it { is_expected.to be_nil }
318
318
  end
319
319
 
320
- context 'without an account_number' do
320
+ context "without an account_number" do
321
321
  before { args.delete(:account_number) }
322
322
  it { is_expected.to be_nil }
323
323
  end
324
324
 
325
- context 'without a bank_code' do
325
+ context "without a bank_code" do
326
326
  before { args.delete(:bank_code) }
327
327
  it { is_expected.to be_nil }
328
328
  end
329
329
 
330
- context 'with a non-numeric branch code' do
331
- before { args[:branch_code] = 'abc123' }
330
+ context "with a non-numeric branch code" do
331
+ before { args[:branch_code] = "abc123" }
332
332
  it { is_expected.to be_nil }
333
333
  end
334
334
  end
335
335
 
336
- context 'with GR as the country_code' do
336
+ context "with GR as the country_code" do
337
337
  let(:args) do
338
338
  {
339
- country_code: 'GR',
340
- bank_code: '011',
341
- branch_code: '0125',
342
- account_number: '0000000012300695'
339
+ country_code: "GR",
340
+ bank_code: "011",
341
+ branch_code: "0125",
342
+ account_number: "0000000012300695",
343
343
  }
344
344
  end
345
345
 
346
- it { is_expected.to eq('GR1601101250000000012300695') }
346
+ it { is_expected.to eq("GR1601101250000000012300695") }
347
347
 
348
- it_behaves_like 'allows round trips', 'GR16 0110 1250 0000 0001 2300 695'
348
+ it_behaves_like "allows round trips", "GR16 0110 1250 0000 0001 2300 695"
349
349
 
350
- context 'without an account_number' do
350
+ context "without an account_number" do
351
351
  before { args.delete(:account_number) }
352
352
  it { is_expected.to be_nil }
353
353
  end
354
354
 
355
- context 'without a bank_code' do
355
+ context "without a bank_code" do
356
356
  before { args.delete(:bank_code) }
357
357
  it { is_expected.to be_nil }
358
358
  end
359
359
 
360
- context 'without a branch_code' do
360
+ context "without a branch_code" do
361
361
  before { args.delete(:branch_code) }
362
362
  it { is_expected.to be_nil }
363
363
  end
364
364
  end
365
365
 
366
- context 'with HR as the country_code' do
366
+ context "with HR as the country_code" do
367
367
  let(:args) do
368
- { country_code: 'HR',
369
- bank_code: '1001005',
370
- account_number: '1863000160' }
368
+ { country_code: "HR",
369
+ bank_code: "1001005",
370
+ account_number: "1863000160" }
371
371
  end
372
372
 
373
- it { is_expected.to eq('HR1210010051863000160') }
373
+ it { is_expected.to eq("HR1210010051863000160") }
374
374
 
375
- it_behaves_like 'allows round trips', 'HR12 1001 0051 8630 0016 0'
375
+ it_behaves_like "allows round trips", "HR12 1001 0051 8630 0016 0"
376
376
 
377
- context 'without a bank_code' do
377
+ context "without a bank_code" do
378
378
  before { args.delete(:bank_code) }
379
379
  it { is_expected.to be_nil }
380
380
  end
381
381
 
382
- context 'without an account_number' do
382
+ context "without an account_number" do
383
383
  before { args.delete(:account_number) }
384
384
  it { is_expected.to be_nil }
385
385
  end
386
386
  end
387
387
 
388
- context 'with HU as the country_code' do
388
+ context "with HU as the country_code" do
389
389
  let(:args) do
390
390
  {
391
- country_code: 'HU',
392
- bank_code: '117',
393
- branch_code: '7301',
394
- account_number: '61111101800000000'
391
+ country_code: "HU",
392
+ bank_code: "117",
393
+ branch_code: "7301",
394
+ account_number: "61111101800000000",
395
395
  }
396
396
  end
397
397
 
398
- it { is_expected.to eq('HU42117730161111101800000000') }
398
+ it { is_expected.to eq("HU42117730161111101800000000") }
399
399
 
400
- it_behaves_like 'allows round trips', 'HU42 1177 3016 1111 1018 0000 0000'
400
+ it_behaves_like "allows round trips", "HU42 1177 3016 1111 1018 0000 0000"
401
401
 
402
- context 'without a bank_code or branch_code' do
402
+ context "without a bank_code or branch_code" do
403
403
  before { args.delete(:bank_code) }
404
404
  before { args.delete(:branch_code) }
405
- before { args[:account_number] = '11773016-11111018-00000000' }
405
+ before { args[:account_number] = "11773016-11111018-00000000" }
406
406
 
407
407
  it { is_expected.to be_nil }
408
408
  end
409
409
 
410
- context 'without a bank_code' do
410
+ context "without a bank_code" do
411
411
  before { args.delete(:bank_code) }
412
- before { args[:account_number] = '11773016-11111018-00000000' }
412
+ before { args[:account_number] = "11773016-11111018-00000000" }
413
413
 
414
414
  it { is_expected.to be_nil }
415
415
  end
416
416
 
417
- context 'without a branch_code' do
417
+ context "without a branch_code" do
418
418
  before { args.delete(:branch_code) }
419
- before { args[:account_number] = '11773016-11111018-00000000' }
419
+ before { args[:account_number] = "11773016-11111018-00000000" }
420
420
 
421
421
  it { is_expected.to be_nil }
422
422
  end
423
423
 
424
- context 'without an account_number' do
424
+ context "without an account_number" do
425
425
  before { args.delete(:account_number) }
426
426
  it { is_expected.to be_nil }
427
427
  end
428
428
  end
429
429
 
430
- context 'with IE as the country_code' do
430
+ context "with IE as the country_code" do
431
431
  let(:args) do
432
- { country_code: 'IE',
433
- bank_code: 'AIBK',
434
- branch_code: '931152',
435
- account_number: '12345678' }
432
+ { country_code: "IE",
433
+ bank_code: "AIBK",
434
+ branch_code: "931152",
435
+ account_number: "12345678" }
436
436
  end
437
437
 
438
- it { is_expected.to eq('IE29AIBK93115212345678') }
438
+ it { is_expected.to eq("IE29AIBK93115212345678") }
439
439
 
440
- it_behaves_like 'allows round trips', 'IE29 AIBK 9311 5212 3456 78'
440
+ it_behaves_like "allows round trips", "IE29 AIBK 9311 5212 3456 78"
441
441
 
442
- context 'without a branch_code' do
442
+ context "without a branch_code" do
443
443
  before { args.delete(:branch_code) }
444
444
  it { is_expected.to be_nil }
445
445
  end
446
446
 
447
- context 'without an account_number' do
447
+ context "without an account_number" do
448
448
  before { args.delete(:account_number) }
449
449
  it { is_expected.to be_nil }
450
450
  end
451
451
 
452
- context 'without a bank_code' do
452
+ context "without a bank_code" do
453
453
  before { args.delete(:bank_code) }
454
454
  it { is_expected.to be_nil }
455
455
  end
456
456
  end
457
457
 
458
- context 'with IS as the country_code' do
458
+ context "with IS as the country_code" do
459
459
  let(:args) do
460
460
  {
461
- country_code: 'IS',
462
- account_number: '260195306702696399',
463
- bank_code: '1175'
461
+ country_code: "IS",
462
+ account_number: "260195306702696399",
463
+ bank_code: "1175",
464
464
  }
465
465
  end
466
466
 
467
- it { is_expected.to eq('IS501175260195306702696399') }
467
+ it { is_expected.to eq("IS501175260195306702696399") }
468
468
 
469
- it_behaves_like 'allows round trips', 'IS50 1175 2601 9530 6702 6963 99'
469
+ it_behaves_like "allows round trips", "IS50 1175 2601 9530 6702 6963 99"
470
470
 
471
- context 'without an account_number' do
471
+ context "without an account_number" do
472
472
  before { args.delete(:account_number) }
473
473
  it { is_expected.to be_nil }
474
474
  end
475
475
 
476
- context 'without a bank_code' do
476
+ context "without a bank_code" do
477
477
  before { args.delete(:bank_code) }
478
478
  it { is_expected.to be_nil }
479
479
  end
480
480
  end
481
481
 
482
- context 'with IT as the country_code' do
482
+ context "with IT as the country_code" do
483
483
  let(:args) do
484
484
  {
485
- country_code: 'IT',
486
- bank_code: '05428',
487
- branch_code: '11101',
488
- account_number: '000000123456'
485
+ country_code: "IT",
486
+ bank_code: "05428",
487
+ branch_code: "11101",
488
+ account_number: "000000123456",
489
489
  }
490
490
  end
491
491
 
492
- it { is_expected.to eq('IT60X0542811101000000123456') }
492
+ it { is_expected.to eq("IT60X0542811101000000123456") }
493
493
 
494
- it_behaves_like 'allows round trips', 'IT60 X054 2811 1010 0000 0123 456'
494
+ it_behaves_like "allows round trips", "IT60 X054 2811 1010 0000 0123 456"
495
495
 
496
- context 'with an explicitly passed check digit' do
497
- before { args[:check_digit] = 'Y' }
498
- it { is_expected.to eq('IT64Y0542811101000000123456') }
496
+ context "with an explicitly passed check digit" do
497
+ before { args[:check_digit] = "Y" }
498
+ it { is_expected.to eq("IT64Y0542811101000000123456") }
499
499
  end
500
500
 
501
- context 'with a bad character in an odd position' do
502
- before { args[:account_number] = '000000123h00' }
501
+ context "with a bad character in an odd position" do
502
+ before { args[:account_number] = "000000123h00" }
503
503
  it { is_expected.to be_nil }
504
504
  end
505
505
 
506
- context 'with a bad character in an even position' do
507
- before { args[:account_number] = '0000001230h0' }
506
+ context "with a bad character in an even position" do
507
+ before { args[:account_number] = "0000001230h0" }
508
508
  it { is_expected.to be_nil }
509
509
  end
510
510
 
511
- context 'without a bank_code' do
511
+ context "without a bank_code" do
512
512
  before { args.delete(:bank_code) }
513
513
  it { is_expected.to be_nil }
514
514
  end
515
515
 
516
- context 'without a branch_code' do
516
+ context "without a branch_code" do
517
517
  before { args.delete(:branch_code) }
518
518
  it { is_expected.to be_nil }
519
519
  end
520
520
 
521
- context 'without an account_number' do
521
+ context "without an account_number" do
522
522
  before { args.delete(:account_number) }
523
523
  it { is_expected.to be_nil }
524
524
  end
525
525
  end
526
526
 
527
- context 'with LT as the country_code' do
527
+ context "with LT as the country_code" do
528
528
  let(:args) do
529
529
  {
530
- country_code: 'LT',
531
- account_number: '11101001000',
532
- bank_code: '10000'
530
+ country_code: "LT",
531
+ account_number: "11101001000",
532
+ bank_code: "10000",
533
533
  }
534
534
  end
535
535
 
536
- it { is_expected.to eq('LT121000011101001000') }
536
+ it { is_expected.to eq("LT121000011101001000") }
537
537
 
538
- it_behaves_like 'allows round trips', 'LT12 1000 0111 0100 1000'
538
+ it_behaves_like "allows round trips", "LT12 1000 0111 0100 1000"
539
539
 
540
- context 'without an account_number' do
540
+ context "without an account_number" do
541
541
  before { args.delete(:account_number) }
542
542
  it { is_expected.to be_nil }
543
543
  end
544
544
 
545
- context 'without a bank_code' do
545
+ context "without a bank_code" do
546
546
  before { args.delete(:bank_code) }
547
547
  it { is_expected.to be_nil }
548
548
  end
549
549
  end
550
550
 
551
- context 'with LU as the country_code' do
551
+ context "with LU as the country_code" do
552
552
  let(:args) do
553
553
  {
554
- country_code: 'LU',
555
- account_number: '9400644750000',
556
- bank_code: '001'
554
+ country_code: "LU",
555
+ account_number: "9400644750000",
556
+ bank_code: "001",
557
557
  }
558
558
  end
559
559
 
560
- it { is_expected.to eq('LU280019400644750000') }
560
+ it { is_expected.to eq("LU280019400644750000") }
561
561
 
562
- it_behaves_like 'allows round trips', 'LU28 0019 4006 4475 0000'
562
+ it_behaves_like "allows round trips", "LU28 0019 4006 4475 0000"
563
563
 
564
- context 'without an account_number' do
564
+ context "without an account_number" do
565
565
  before { args.delete(:account_number) }
566
566
  it { is_expected.to be_nil }
567
567
  end
568
568
 
569
- context 'without a bank_code' do
569
+ context "without a bank_code" do
570
570
  before { args.delete(:bank_code) }
571
571
  it { is_expected.to be_nil }
572
572
  end
573
573
  end
574
574
 
575
- context 'with LV as the country_code' do
575
+ context "with LV as the country_code" do
576
576
  let(:args) do
577
577
  {
578
- country_code: 'LV',
579
- account_number: '1234567890123',
580
- bank_code: 'BANK'
578
+ country_code: "LV",
579
+ account_number: "1234567890123",
580
+ bank_code: "BANK",
581
581
  }
582
582
  end
583
583
 
584
- it { is_expected.to eq('LV72BANK1234567890123') }
584
+ it { is_expected.to eq("LV72BANK1234567890123") }
585
585
 
586
- it_behaves_like 'allows round trips', 'LV72 BANK 1234 5678 9012 3'
586
+ it_behaves_like "allows round trips", "LV72 BANK 1234 5678 9012 3"
587
587
 
588
- context 'without an account_number' do
588
+ context "without an account_number" do
589
589
  before { args.delete(:account_number) }
590
590
  it { is_expected.to be_nil }
591
591
  end
592
592
 
593
- context 'without a bank_code' do
593
+ context "without a bank_code" do
594
594
  before { args.delete(:bank_code) }
595
595
  it { is_expected.to be_nil }
596
596
  end
597
597
  end
598
598
 
599
- context 'with MC as the country_code' do
599
+ context "with MC as the country_code" do
600
600
  let(:args) do
601
601
  {
602
- country_code: 'MC',
603
- bank_code: '20041',
604
- branch_code: '01005',
605
- account_number: '0500013M02606'
602
+ country_code: "MC",
603
+ bank_code: "20041",
604
+ branch_code: "01005",
605
+ account_number: "0500013M02606",
606
606
  }
607
607
  end
608
608
 
609
- it { is_expected.to eq('MC9320041010050500013M02606') }
609
+ it { is_expected.to eq("MC9320041010050500013M02606") }
610
610
 
611
- it_behaves_like 'allows round trips', 'MC93 2004 1010 0505 0001 3M02 606'
611
+ it_behaves_like "allows round trips", "MC93 2004 1010 0505 0001 3M02 606"
612
612
 
613
- context 'without the rib key in the account number' do
614
- before { args[:account_number] = '0500013M026' }
613
+ context "without the rib key in the account number" do
614
+ before { args[:account_number] = "0500013M026" }
615
615
  specify { expect(Ibandit::IBAN.new(assemble)).to_not be_valid }
616
616
  end
617
617
 
618
- context 'without a bank_code' do
618
+ context "without a bank_code" do
619
619
  before { args.delete(:bank_code) }
620
620
  it { is_expected.to be_nil }
621
621
  end
622
622
 
623
- context 'without a branch_code' do
623
+ context "without a branch_code" do
624
624
  before { args.delete(:branch_code) }
625
625
  it { is_expected.to be_nil }
626
626
  end
627
627
 
628
- context 'without an account_number' do
628
+ context "without an account_number" do
629
629
  before { args.delete(:account_number) }
630
630
  it { is_expected.to be_nil }
631
631
  end
632
632
  end
633
633
 
634
- context 'with MT as the country_code' do
634
+ context "with MT as the country_code" do
635
635
  let(:args) do
636
636
  {
637
- country_code: 'MT',
638
- bank_code: 'MMEB',
639
- branch_code: '44093',
640
- account_number: '000000009027293051'
637
+ country_code: "MT",
638
+ bank_code: "MMEB",
639
+ branch_code: "44093",
640
+ account_number: "000000009027293051",
641
641
  }
642
642
  end
643
643
 
644
- it { is_expected.to eq('MT98MMEB44093000000009027293051') }
644
+ it { is_expected.to eq("MT98MMEB44093000000009027293051") }
645
645
 
646
646
  it_behaves_like(
647
- 'allows round trips',
648
- 'MT98 MMEB 4409 3000 0000 0902 7293 051'
647
+ "allows round trips",
648
+ "MT98 MMEB 4409 3000 0000 0902 7293 051",
649
649
  )
650
650
 
651
- context 'without a branch_code' do
651
+ context "without a branch_code" do
652
652
  before { args.delete(:branch_code) }
653
653
  it { is_expected.to be_nil }
654
654
  end
655
655
 
656
- context 'without an account_number' do
656
+ context "without an account_number" do
657
657
  before { args.delete(:account_number) }
658
658
  it { is_expected.to be_nil }
659
659
  end
660
660
 
661
- context 'without a bank_code' do
661
+ context "without a bank_code" do
662
662
  before { args.delete(:bank_code) }
663
663
  it { is_expected.to be_nil }
664
664
  end
665
665
 
666
- context 'with a non-numeric branch code' do
667
- before { args[:branch_code] = 'abc123' }
666
+ context "with a non-numeric branch code" do
667
+ before { args[:branch_code] = "abc123" }
668
668
  it { is_expected.to be_nil }
669
669
  end
670
670
  end
671
671
 
672
- context 'with NL as the country_code' do
672
+ context "with NL as the country_code" do
673
673
  let(:args) do
674
674
  {
675
- country_code: 'NL',
676
- account_number: '0417164300',
677
- bank_code: 'ABNA'
675
+ country_code: "NL",
676
+ account_number: "0417164300",
677
+ bank_code: "ABNA",
678
678
  }
679
679
  end
680
680
 
681
- it { is_expected.to eq('NL91ABNA0417164300') }
681
+ it { is_expected.to eq("NL91ABNA0417164300") }
682
682
 
683
- it_behaves_like 'allows round trips', 'NL91 ABNA 0417 1643 00'
683
+ it_behaves_like "allows round trips", "NL91 ABNA 0417 1643 00"
684
684
 
685
- context 'without an account_number' do
685
+ context "without an account_number" do
686
686
  before { args.delete(:account_number) }
687
687
  it { is_expected.to be_nil }
688
688
  end
689
689
 
690
- context 'without an bank_code' do
690
+ context "without an bank_code" do
691
691
  before { args.delete(:bank_code) }
692
692
  it { is_expected.to be_nil }
693
693
  end
694
694
  end
695
695
 
696
- context 'with NO as the country_code' do
696
+ context "with NO as the country_code" do
697
697
  let(:args) do
698
698
  {
699
- country_code: 'NO',
700
- bank_code: '8601',
701
- account_number: '1117947'
699
+ country_code: "NO",
700
+ bank_code: "8601",
701
+ account_number: "1117947",
702
702
  }
703
703
  end
704
704
 
705
- it { is_expected.to eq('NO9386011117947') }
705
+ it { is_expected.to eq("NO9386011117947") }
706
706
 
707
- it_behaves_like 'allows round trips', 'NO93 8601 1117 947'
707
+ it_behaves_like "allows round trips", "NO93 8601 1117 947"
708
708
 
709
- context 'without a bank_code' do
709
+ context "without a bank_code" do
710
710
  before { args.delete(:bank_code) }
711
- before { args[:account_number] = '86011117947' }
711
+ before { args[:account_number] = "86011117947" }
712
712
 
713
713
  it { is_expected.to be_nil }
714
714
  end
715
715
 
716
- context 'without an account_number' do
716
+ context "without an account_number" do
717
717
  before { args.delete(:account_number) }
718
718
  it { is_expected.to be_nil }
719
719
  end
720
720
  end
721
721
 
722
- context 'with PL as the country_code' do
722
+ context "with PL as the country_code" do
723
723
  let(:args) do
724
724
  {
725
- country_code: 'PL',
726
- bank_code: '10201026',
727
- account_number: '0000042270201111'
725
+ country_code: "PL",
726
+ bank_code: "10201026",
727
+ account_number: "0000042270201111",
728
728
  }
729
729
  end
730
730
 
731
- it { is_expected.to eq('PL60102010260000042270201111') }
731
+ it { is_expected.to eq("PL60102010260000042270201111") }
732
732
 
733
- it_behaves_like 'allows round trips', 'PL60 1020 1026 0000 0422 7020 1111'
733
+ it_behaves_like "allows round trips", "PL60 1020 1026 0000 0422 7020 1111"
734
734
 
735
- context 'without a bank_code' do
735
+ context "without a bank_code" do
736
736
  before { args.delete(:bank_code) }
737
- before { args[:account_number] = '60102010260000042270201111' }
737
+ before { args[:account_number] = "60102010260000042270201111" }
738
738
 
739
739
  it { is_expected.to be_nil }
740
740
  end
741
741
 
742
- context 'without an account_number' do
742
+ context "without an account_number" do
743
743
  before { args.delete(:account_number) }
744
744
  it { is_expected.to be_nil }
745
745
  end
746
746
  end
747
747
 
748
- context 'with PT as the country_code' do
748
+ context "with PT as the country_code" do
749
749
  let(:args) do
750
750
  {
751
- country_code: 'PT',
752
- bank_code: '0002',
753
- branch_code: '0023',
754
- account_number: '0023843000578'
751
+ country_code: "PT",
752
+ bank_code: "0002",
753
+ branch_code: "0023",
754
+ account_number: "0023843000578",
755
755
  }
756
756
  end
757
757
 
758
- it { is_expected.to eq('PT50000200230023843000578') }
758
+ it { is_expected.to eq("PT50000200230023843000578") }
759
759
 
760
- it_behaves_like 'allows round trips', 'PT50 0002 0023 0023 8430 0057 8'
760
+ it_behaves_like "allows round trips", "PT50 0002 0023 0023 8430 0057 8"
761
761
 
762
- context 'without a bank_code' do
762
+ context "without a bank_code" do
763
763
  before { args.delete(:bank_code) }
764
764
  it { is_expected.to be_nil }
765
765
  end
766
766
 
767
- context 'without a branch_code' do
767
+ context "without a branch_code" do
768
768
  before { args.delete(:branch_code) }
769
769
  it { is_expected.to be_nil }
770
770
  end
771
771
 
772
- context 'without an account_number' do
772
+ context "without an account_number" do
773
773
  before { args.delete(:account_number) }
774
774
  it { is_expected.to be_nil }
775
775
  end
776
776
  end
777
777
 
778
- context 'with RO as the country_code' do
778
+ context "with RO as the country_code" do
779
779
  let(:args) do
780
780
  {
781
- country_code: 'RO',
782
- account_number: '1B31007593840000',
783
- bank_code: 'AAAA'
781
+ country_code: "RO",
782
+ account_number: "1B31007593840000",
783
+ bank_code: "AAAA",
784
784
  }
785
785
  end
786
786
 
787
- it { is_expected.to eq('RO49AAAA1B31007593840000') }
787
+ it { is_expected.to eq("RO49AAAA1B31007593840000") }
788
788
 
789
- it_behaves_like 'allows round trips', 'RO49 AAAA 1B31 0075 9384 0000'
789
+ it_behaves_like "allows round trips", "RO49 AAAA 1B31 0075 9384 0000"
790
790
 
791
- context 'without an account_number' do
791
+ context "without an account_number" do
792
792
  before { args.delete(:account_number) }
793
793
  it { is_expected.to be_nil }
794
794
  end
795
795
 
796
- context 'without a bank_code' do
796
+ context "without a bank_code" do
797
797
  before { args.delete(:bank_code) }
798
798
  it { is_expected.to be_nil }
799
799
  end
800
800
  end
801
801
 
802
- context 'with SE as the country_code' do
802
+ context "with SE as the country_code" do
803
803
  let(:args) do
804
804
  {
805
- country_code: 'SE',
806
- bank_code: '500',
807
- account_number: '00000050011045825'
805
+ country_code: "SE",
806
+ bank_code: "500",
807
+ account_number: "00000050011045825",
808
808
  }
809
809
  end
810
810
 
811
- it { is_expected.to eq('SE0450000000050011045825') }
811
+ it { is_expected.to eq("SE0450000000050011045825") }
812
812
 
813
- it_behaves_like 'allows round trips', 'SE04 5000 0000 0500 1104 5825'
813
+ it_behaves_like "allows round trips", "SE04 5000 0000 0500 1104 5825"
814
814
 
815
- context 'without a bank_code' do
815
+ context "without a bank_code" do
816
816
  before { args.delete(:bank_code) }
817
817
  it { is_expected.to be_nil }
818
818
  end
819
819
 
820
- context 'without an account_number' do
820
+ context "without an account_number" do
821
821
  before { args.delete(:account_number) }
822
822
  it { is_expected.to be_nil }
823
823
  end
824
824
  end
825
825
 
826
- context 'with SI as the country_code' do
826
+ context "with SI as the country_code" do
827
827
  let(:args) do
828
828
  {
829
- country_code: 'SI',
830
- bank_code: '19100',
831
- account_number: '0000123438'
829
+ country_code: "SI",
830
+ bank_code: "19100",
831
+ account_number: "0000123438",
832
832
  }
833
833
  end
834
834
 
835
- it { is_expected.to eq('SI56191000000123438') }
835
+ it { is_expected.to eq("SI56191000000123438") }
836
836
 
837
- it_behaves_like 'allows round trips', 'SI56 1910 0000 0123 438'
837
+ it_behaves_like "allows round trips", "SI56 1910 0000 0123 438"
838
838
 
839
- context 'without a bank_code' do
839
+ context "without a bank_code" do
840
840
  before { args.delete(:bank_code) }
841
841
  it { is_expected.to be_nil }
842
842
  end
843
843
 
844
- context 'without an account_number' do
844
+ context "without an account_number" do
845
845
  before { args.delete(:account_number) }
846
846
  it { is_expected.to be_nil }
847
847
  end
848
848
  end
849
849
 
850
- context 'with SK as the country_code' do
850
+ context "with SK as the country_code" do
851
851
  let(:args) do
852
852
  {
853
- country_code: 'SK',
854
- bank_code: '1200',
855
- account_number: '0000198742637541'
853
+ country_code: "SK",
854
+ bank_code: "1200",
855
+ account_number: "0000198742637541",
856
856
  }
857
857
  end
858
858
 
859
- it { is_expected.to eq('SK3112000000198742637541') }
859
+ it { is_expected.to eq("SK3112000000198742637541") }
860
860
 
861
- it_behaves_like 'allows round trips', 'SK31 1200 0000 1987 4263 7541'
861
+ it_behaves_like "allows round trips", "SK31 1200 0000 1987 4263 7541"
862
862
 
863
- context 'without a bank_code' do
863
+ context "without a bank_code" do
864
864
  before { args.delete(:bank_code) }
865
865
  it { is_expected.to be_nil }
866
866
  end
867
867
 
868
- context 'without an account_number' do
868
+ context "without an account_number" do
869
869
  before { args.delete(:account_number) }
870
870
  it { is_expected.to be_nil }
871
871
  end
872
872
  end
873
873
 
874
- context 'with SM as the country_code' do
874
+ context "with SM as the country_code" do
875
875
  let(:args) do
876
876
  {
877
- country_code: 'SM',
878
- bank_code: '05428',
879
- branch_code: '11101',
880
- account_number: '000000123456'
877
+ country_code: "SM",
878
+ bank_code: "05428",
879
+ branch_code: "11101",
880
+ account_number: "000000123456",
881
881
  }
882
882
  end
883
883
 
884
- it { is_expected.to eq('SM88X0542811101000000123456') }
884
+ it { is_expected.to eq("SM88X0542811101000000123456") }
885
885
 
886
- it_behaves_like 'allows round trips', 'SM88 X054 2811 1010 0000 0123 456'
886
+ it_behaves_like "allows round trips", "SM88 X054 2811 1010 0000 0123 456"
887
887
 
888
- context 'without a bank_code' do
888
+ context "without a bank_code" do
889
889
  before { args.delete(:bank_code) }
890
890
  it { is_expected.to be_nil }
891
891
  end
892
892
 
893
- context 'without a branch_code' do
893
+ context "without a branch_code" do
894
894
  before { args.delete(:branch_code) }
895
895
  it { is_expected.to be_nil }
896
896
  end
897
897
 
898
- context 'without an account_number' do
898
+ context "without an account_number" do
899
899
  before { args.delete(:account_number) }
900
900
  it { is_expected.to be_nil }
901
901
  end