sepa_king 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe SEPA::DebtTransaction do
5
+ it 'should initialize a new transaction' do
6
+ lambda{
7
+ SEPA::DebtTransaction.new :name => 'Zahlemann & Söhne Gbr',
8
+ :iban => 'DE21500500009876543210',
9
+ :bic => 'SPUEDE2UXXX',
10
+ :amount => 39.99,
11
+ :reference => 'XYZ-1234/123',
12
+ :mandate_id => 'K-02-2011-12345',
13
+ :mandate_date_of_signature => Date.new(2011,01,25)
14
+ }.should_not raise_error
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe SEPA::DirectDebitInitiation do
5
+ it 'should create valid XML file' do
6
+ ddi = SEPA::DirectDebitInitiation.new :name => 'Gläubiger GmbH',
7
+ :bic => 'BANKDEFFXXX',
8
+ :iban => 'DE87200500001234567890',
9
+ :identifier => 'DE98ZZZ09999999999'
10
+
11
+ ddi.add_transaction :name => 'Zahlemann & Söhne GbR',
12
+ :iban => 'DE21500500009876543210',
13
+ :bic => 'SPUEDE2UXXX',
14
+ :amount => 39.99,
15
+ :reference => 'XYZ/2013-08-ABO/12345',
16
+ :mandate_id => 'K-02-2011-12345',
17
+ :mandate_date_of_signature => Date.new(2011,01,25)
18
+
19
+ ddi.add_transaction :name => 'Meier & Schulze oHG',
20
+ :iban => 'DE68210501700012345678',
21
+ :bic => 'GENODEF1JEV',
22
+ :amount => 750.00,
23
+ :reference => 'XYZ/2013-08-ABO/6789',
24
+ :mandate_id => 'K-08-2010-42123',
25
+ :mandate_date_of_signature => Date.new(2010,07,25)
26
+
27
+ XML::Document.string(ddi.to_xml).should validate_against('pain.008.002.02.xsd')
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe SEPA::TextConverter do
5
+ include SEPA::TextConverter
6
+
7
+ it "should convert to upper case" do
8
+ convert_text('2&2 GmbH & Co. KG').should == '22 GmbH Co. KG'
9
+ end
10
+
11
+ it "should remove invalid chars" do
12
+ convert_text('&@"=<>!').should == ''
13
+ end
14
+
15
+ it "should leave valid chars" do
16
+ convert_text("abc-ABC-0123- ':?,-(+.)/").should == "abc-ABC-0123- ':?,-(+.)/"
17
+ end
18
+
19
+ it "should convert umlaute" do
20
+ convert_text('üöäÜÖÄß').should == 'ueoeaeUEOEAEss'
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Credit Transfer Initiation' do
4
+ it "should validate example file" do
5
+ XML::Document.file('spec/fixtures/pain.001.002.03.xml').should validate_against('pain.001.002.03.xsd')
6
+ end
7
+ end
8
+
9
+ describe 'Direct Debit Initiation' do
10
+ it 'should validate example file' do
11
+ XML::Document.file('spec/fixtures/pain.008.002.02.xml').should validate_against('pain.008.002.02.xsd')
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+
6
+ require 'simplecov'
7
+ SimpleCov.start
8
+
9
+ require 'ostruct'
10
+ require 'xml'
11
+ require 'sepa_king'
12
+
13
+ # Requires supporting ruby files with custom matchers and macros, etc,
14
+ # in spec/support/ and its subdirectories.
15
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
16
+
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ config.treat_symbols_as_metadata_keys_with_true_values = true
20
+ config.run_all_when_everything_filtered = true
21
+ config.filter_run :focus
22
+
23
+ # Run specs in random order to surface order dependencies. If you find an
24
+ # order dependency and want to debug it, you can fix the order by providing
25
+ # the seed, which is printed after each run.
26
+ # --seed 1234
27
+ config.order = 'random'
28
+ end
@@ -0,0 +1,9 @@
1
+ require 'rspec/expectations'
2
+
3
+ RSpec::Matchers.define :validate_against do |xsd|
4
+ match do |actual|
5
+ schema_doc = XML::Document.file("lib/schema/#{xsd}")
6
+ schema = XML::Schema.document(schema_doc)
7
+ actual.validate_schema(schema)
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sepa_king
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Georg Leciejewski
8
+ - Georg Ledermann
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: i18n
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: builder
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: simplecov
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 0.9.2
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: 0.9.2
84
+ - !ruby/object:Gem::Dependency
85
+ name: libxml-ruby
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ description: ''
99
+ email: gl@salesking.eu
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files:
103
+ - README.markdown
104
+ files:
105
+ - .gitignore
106
+ - .rspec
107
+ - .travis.yml
108
+ - Gemfile
109
+ - MIT-LICENSE
110
+ - README.markdown
111
+ - Rakefile
112
+ - lib/schema/pain.001.002.03.xsd
113
+ - lib/schema/pain.008.002.02.xsd
114
+ - lib/sepa_king.rb
115
+ - lib/sepa_king/account.rb
116
+ - lib/sepa_king/credit_transaction.rb
117
+ - lib/sepa_king/credit_transfer_initiation.rb
118
+ - lib/sepa_king/debt_transaction.rb
119
+ - lib/sepa_king/direct_debit_initiation.rb
120
+ - lib/sepa_king/exception.rb
121
+ - lib/sepa_king/text_converter.rb
122
+ - lib/sepa_king/version.rb
123
+ - sepa_king.gemspec
124
+ - spec/fixtures/pain.001.002.03.xml
125
+ - spec/fixtures/pain.008.002.02.xml
126
+ - spec/sepa_king/account_spec.rb
127
+ - spec/sepa_king/credit_transaction_spec.rb
128
+ - spec/sepa_king/credit_transfer_initiation_spec.rb
129
+ - spec/sepa_king/debt_transaction_spec.rb
130
+ - spec/sepa_king/direct_debit_inititation_spec.rb
131
+ - spec/sepa_king/text_converter_spec.rb
132
+ - spec/sepa_king/validation_spec.rb
133
+ - spec/spec_helper.rb
134
+ - spec/support/custom_matcher.rb
135
+ homepage: http://github.com/salesking/sepa_king
136
+ licenses: []
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.0.7
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Generate SEPA XML files with Ruby .. the easy way
158
+ test_files:
159
+ - spec/fixtures/pain.001.002.03.xml
160
+ - spec/fixtures/pain.008.002.02.xml
161
+ - spec/sepa_king/account_spec.rb
162
+ - spec/sepa_king/credit_transaction_spec.rb
163
+ - spec/sepa_king/credit_transfer_initiation_spec.rb
164
+ - spec/sepa_king/debt_transaction_spec.rb
165
+ - spec/sepa_king/direct_debit_inititation_spec.rb
166
+ - spec/sepa_king/text_converter_spec.rb
167
+ - spec/sepa_king/validation_spec.rb
168
+ - spec/spec_helper.rb
169
+ - spec/support/custom_matcher.rb