dtaus 0.2.0 → 0.2.1

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.
@@ -1,23 +1,23 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module DTAUS
4
-
4
+
5
5
  # Utility class for converting strings and numbers to DTA-conform representations
6
6
  class Converter
7
-
7
+
8
8
  # Zeichen umsetzen gemäss DTA-Norm
9
9
  #
10
10
  def self.convert_text(_text)
11
11
  tmp = _text.to_s.dup
12
- tmp = tmp.upcase()
13
- tmp = tmp.gsub('Ä', 'AE')
14
- tmp = tmp.gsub('Ü', 'UE')
15
- tmp = tmp.gsub('Ö', 'OE')
16
- tmp = tmp.gsub('ä', 'AE')
17
- tmp = tmp.gsub('ü', 'UE')
18
- tmp = tmp.gsub('ö', 'OE')
19
- tmp = tmp.gsub('ß', 'SS')
20
- tmp = tmp.strip
12
+
13
+ tmp.upcase!
14
+ tmp.gsub!(/[Ää]/u, 'AE')
15
+ tmp.gsub!(/[Öö]/u, 'OE')
16
+ tmp.gsub!(/[Üü]/u, 'UE')
17
+ tmp.gsub!(/ß/u, 'SS')
18
+ tmp.strip!
19
+
20
+ return tmp
21
21
  end
22
22
 
23
23
  # Konvertiert einen String in einen Integer
@@ -31,6 +31,6 @@ module DTAUS
31
31
  else raise DTAUSException.new("Cannot convert #{_number.class} to Integer")
32
32
  end
33
33
  end
34
-
34
+
35
35
  end
36
36
  end
@@ -1,16 +1,18 @@
1
+ # encoding: utf-8
2
+
1
3
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
4
 
3
5
  class BuchungTest < Test::Unit::TestCase
4
6
 
5
7
  def setup
6
8
  @konto = DTAUS::Konto.new(
7
- :kontonummer => 1234567890,
8
- :blz => 12345678,
9
- :kontoinhaber => 'Kunde',
9
+ :kontonummer => 1234567890,
10
+ :blz => 12345678,
11
+ :kontoinhaber => 'Kunde',
10
12
  :bankname =>'Bank Name'
11
13
  )
12
14
  end
13
-
15
+
14
16
  def test_initialize
15
17
  buchung = DTAUS::Buchung.new(
16
18
  :kunden_konto => @konto,
@@ -34,11 +36,11 @@ class BuchungTest < Test::Unit::TestCase
34
36
  assert_equal 10000, buchung.betrag
35
37
  assert_equal false, buchung.positiv?
36
38
  assert_equal "VIELEN DANK FUER IHREN EINKAUF!", buchung.verwendungszweck
37
-
39
+
38
40
  konto = DTAUS::Konto.new(
39
- :kontonummer => 1234567890,
40
- :blz => 12345678,
41
- :kontoinhaber => 'Sehr laaaaaaanger Kundenname GmbH',
41
+ :kontonummer => 1234567890,
42
+ :blz => 12345678,
43
+ :kontoinhaber => 'Sehr laaaaaaanger Kundenname GmbH',
42
44
  :bankname =>'Bank Name'
43
45
  )
44
46
  buchung = DTAUS::Buchung.new(
@@ -49,7 +51,7 @@ class BuchungTest < Test::Unit::TestCase
49
51
  assert buchung, "Buchung kann mit langem Kundennamen angelegt werden"
50
52
  assert_equal 2, buchung.erweiterungen.size
51
53
  end
52
-
54
+
53
55
  def test_initialize_missing_parameters
54
56
  exception = assert_raise( ArgumentError ) do
55
57
  DTAUS::Buchung.new(
@@ -70,7 +72,7 @@ class BuchungTest < Test::Unit::TestCase
70
72
  assert_equal "Missing params[:betrag] for new Buchung.", exception.message
71
73
 
72
74
  end
73
-
75
+
74
76
  def test_initialize_incorrect_transaktionstyp
75
77
  exception = assert_raise( DTAUS::DTAUSException ) do
76
78
  DTAUS::Buchung.new(
@@ -95,7 +97,7 @@ class BuchungTest < Test::Unit::TestCase
95
97
  end
96
98
  assert_equal "Konto expected for Parameter 'kunden_konto', got Fixnum", exception.message
97
99
  end
98
-
100
+
99
101
  def test_initialize_correct_betrag
100
102
  booking = DTAUS::Buchung.new(
101
103
  :kunden_konto => @konto,
@@ -140,7 +142,7 @@ class BuchungTest < Test::Unit::TestCase
140
142
  assert_equal 001, booking.betrag
141
143
 
142
144
  end
143
-
145
+
144
146
  def test_initialize_incorrect_betrag
145
147
  exception = assert_raise( DTAUS::DTAUSException ) do
146
148
  DTAUS::Buchung.new(
@@ -164,9 +166,9 @@ class BuchungTest < Test::Unit::TestCase
164
166
  def test_initialize_incorrect_erweiterungen
165
167
  exception = assert_raise( DTAUS::IncorrectSizeException ) do
166
168
  konto = DTAUS::Konto.new(
167
- :kontonummer => 1234567890,
168
- :blz => 12345678,
169
- :kontoinhaber => 'seeeeeeeehr laaaaaaaanger naaaaaame ' * 9,
169
+ :kontonummer => 1234567890,
170
+ :blz => 12345678,
171
+ :kontoinhaber => 'seeeeeeeehr laaaaaaaanger naaaaaame ' * 9,
170
172
  :bankname =>'Bank Name'
171
173
  )
172
174
 
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
4
 
3
5
  class ConverterTest < Test::Unit::TestCase
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
4
 
3
5
  class DatensatzTest < Test::Unit::TestCase
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
4
 
3
5
  class ErweiterungTest < Test::Unit::TestCase
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
4
 
3
5
  class KontoTest < Test::Unit::TestCase
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtaus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
5
+ version: 0.2.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - mikezter
@@ -63,23 +58,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
58
  requirements:
64
59
  - - ">="
65
60
  - !ruby/object:Gem::Version
66
- hash: 3
67
- segments:
68
- - 0
69
61
  version: "0"
70
62
  required_rubygems_version: !ruby/object:Gem::Requirement
71
63
  none: false
72
64
  requirements:
73
65
  - - ">="
74
66
  - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
67
  version: "0"
79
68
  requirements: []
80
69
 
81
70
  rubyforge_project:
82
- rubygems_version: 1.6.2
71
+ rubygems_version: 1.5.2
83
72
  signing_key:
84
73
  specification_version: 3
85
74
  summary: DTAUS allows to easily create DTAUS files for the german banking sector