ci_power 0.0.26 → 0.0.27
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.
- data/lib/ci_power/action.rb +63 -63
- data/lib/ci_power/address.rb +97 -97
- data/lib/ci_power/communication.rb +18 -18
- data/lib/ci_power/debt_claim.rb +73 -73
- data/lib/ci_power/debtor_data.rb +65 -65
- data/lib/ci_power/dossier_data.rb +93 -93
- data/lib/ci_power/export.rb +171 -171
- data/lib/ci_power/installment_plan.rb +39 -39
- data/lib/ci_power/open_appointment.rb +45 -45
- data/lib/ci_power/process_data.rb +108 -108
- data/lib/ci_power/record.rb +41 -41
- data/lib/ci_power/version.rb +3 -3
- data/lib/ci_power.rb +14 -13
- data/lib/generators/ci_power/ci_power_generator.rb +11 -11
- data/lib/generators/ci_power/templates/cip_export.rb +12 -12
- data/lib/tasks/ci_power.rake +23 -23
- data/spec/ci_power/export_spec.rb +74 -74
- data/spec/ci_power/installment_plan_spec.rb +60 -60
- data/spec/spec_helper.rb +20 -20
- metadata +88 -94
@@ -1,75 +1,75 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module CiPower
|
4
|
-
describe Export do
|
5
|
-
# created dummy class with module behaviour
|
6
|
-
let(:dummy_class) do
|
7
|
-
Class.new do
|
8
|
-
extend(CiPower::Export)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
context "when module is included" do
|
13
|
-
it "output should an empty array" do
|
14
|
-
dummy_class.output.should be_instance_of Array
|
15
|
-
dummy_class.output.should be_empty
|
16
|
-
end
|
17
|
-
|
18
|
-
it "group_no should be 0" do
|
19
|
-
dummy_class.group_no.should == 0
|
20
|
-
end
|
21
|
-
|
22
|
-
it "data_format should be '%Y%m%d'" do
|
23
|
-
dummy_class.date_format.should == '%Y%m%d'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#convert_date" do
|
28
|
-
it "when date is valid should convert date to format" do
|
29
|
-
|
30
|
-
unconverted_date = Time.local 2012, 7, 31
|
31
|
-
|
32
|
-
converted_date = dummy_class.convert_date(unconverted_date)
|
33
|
-
converted_date.should == "20120731"
|
34
|
-
end
|
35
|
-
|
36
|
-
it "when date is not valid do nothing" do
|
37
|
-
converted_date = dummy_class.convert_date("XXX")
|
38
|
-
converted_date.should be_nil
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "#date_format" do
|
43
|
-
it "should change the date format" do
|
44
|
-
dummy_class.date_format = 'new_format'
|
45
|
-
dummy_class.date_format.should == 'new_format'
|
46
|
-
end
|
47
|
-
|
48
|
-
context "when the date format is changed" do
|
49
|
-
before(:each) { dummy_class.date_format = '%d-%m-%Y' }
|
50
|
-
|
51
|
-
it "should format the date with the new format" do
|
52
|
-
date_string = dummy_class.convert_date Time.local(2012, 7, 31)
|
53
|
-
date_string.should == "31-07-2012"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
{:dossier_data_record => 'CiPower::DossierData',
|
59
|
-
:address_record => 'CiPower::Address',
|
60
|
-
:communication_record => 'CiPower::Communication',
|
61
|
-
:debtor_data_record => 'CiPower::DebtorData',
|
62
|
-
:debt_claim_record => 'CiPower::DebtClaim',
|
63
|
-
:action_record => 'CiPower::Action',
|
64
|
-
:open_appointment_record => 'CiPower::OpenAppointment',
|
65
|
-
:installment_plan_record => 'CiPower::InstallmentPlan'
|
66
|
-
}.each do |method, clazz|
|
67
|
-
describe "##{method.to_s}" do
|
68
|
-
it "generates a new instance of #{clazz}" do
|
69
|
-
record = dummy_class.send(method, :test => 'test')
|
70
|
-
record.should be_instance_of clazz.split("::").inject(Object) { |ref, clazz| ref::const_get(clazz) }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CiPower
|
4
|
+
describe Export do
|
5
|
+
# created dummy class with module behaviour
|
6
|
+
let(:dummy_class) do
|
7
|
+
Class.new do
|
8
|
+
extend(CiPower::Export)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context "when module is included" do
|
13
|
+
it "output should an empty array" do
|
14
|
+
dummy_class.output.should be_instance_of Array
|
15
|
+
dummy_class.output.should be_empty
|
16
|
+
end
|
17
|
+
|
18
|
+
it "group_no should be 0" do
|
19
|
+
dummy_class.group_no.should == 0
|
20
|
+
end
|
21
|
+
|
22
|
+
it "data_format should be '%Y%m%d'" do
|
23
|
+
dummy_class.date_format.should == '%Y%m%d'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#convert_date" do
|
28
|
+
it "when date is valid should convert date to format" do
|
29
|
+
|
30
|
+
unconverted_date = Time.local 2012, 7, 31
|
31
|
+
|
32
|
+
converted_date = dummy_class.convert_date(unconverted_date)
|
33
|
+
converted_date.should == "20120731"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "when date is not valid do nothing" do
|
37
|
+
converted_date = dummy_class.convert_date("XXX")
|
38
|
+
converted_date.should be_nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#date_format" do
|
43
|
+
it "should change the date format" do
|
44
|
+
dummy_class.date_format = 'new_format'
|
45
|
+
dummy_class.date_format.should == 'new_format'
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when the date format is changed" do
|
49
|
+
before(:each) { dummy_class.date_format = '%d-%m-%Y' }
|
50
|
+
|
51
|
+
it "should format the date with the new format" do
|
52
|
+
date_string = dummy_class.convert_date Time.local(2012, 7, 31)
|
53
|
+
date_string.should == "31-07-2012"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
{:dossier_data_record => 'CiPower::DossierData',
|
59
|
+
:address_record => 'CiPower::Address',
|
60
|
+
:communication_record => 'CiPower::Communication',
|
61
|
+
:debtor_data_record => 'CiPower::DebtorData',
|
62
|
+
:debt_claim_record => 'CiPower::DebtClaim',
|
63
|
+
:action_record => 'CiPower::Action',
|
64
|
+
:open_appointment_record => 'CiPower::OpenAppointment',
|
65
|
+
:installment_plan_record => 'CiPower::InstallmentPlan'
|
66
|
+
}.each do |method, clazz|
|
67
|
+
describe "##{method.to_s}" do
|
68
|
+
it "generates a new instance of #{clazz}" do
|
69
|
+
record = dummy_class.send(method, :test => 'test')
|
70
|
+
record.should be_instance_of clazz.split("::").inject(Object) { |ref, clazz| ref::const_get(clazz) }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
75
|
end
|
@@ -1,61 +1,61 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module CiPower
|
4
|
-
describe InstallmentPlan do
|
5
|
-
describe "Functions" do
|
6
|
-
let(:installment_plan) do
|
7
|
-
InstallmentPlan.new :group_no => '1',
|
8
|
-
:address_identification_debtee => '123456',
|
9
|
-
:address_identification_debtor => '987654',
|
10
|
-
:no_of_installments => '4',
|
11
|
-
:installment_amount => '215',
|
12
|
-
:first_installment_date => '20120816',
|
13
|
-
:period => 'Month',
|
14
|
-
:interval => '2',
|
15
|
-
:installment_fee => '15',
|
16
|
-
:fixed_size_installment_amount => '0',
|
17
|
-
:last_installment_date => '20130416'
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#to_cip" do
|
22
|
-
it "record_type should be 15 on pos 1" do
|
23
|
-
installment_plan.to_cip[0..1].should == '15'
|
24
|
-
end
|
25
|
-
it "group_no should be 1 on pos 3" do
|
26
|
-
installment_plan.to_cip[2..8].strip.should == '1'
|
27
|
-
end
|
28
|
-
it "address_identification_debtee should be 123456 on pos 10" do
|
29
|
-
installment_plan.to_cip[9..33].strip.should == '123456'
|
30
|
-
end
|
31
|
-
it "address_identification_debtor should be 987654 on pos 35" do
|
32
|
-
installment_plan.to_cip[34..58].strip.should == '987654'
|
33
|
-
end
|
34
|
-
it "no_of_installments should be 4 on pos 60" do
|
35
|
-
installment_plan.to_cip[59..61].strip.should == '4'
|
36
|
-
end
|
37
|
-
it "installment_amount should be 215 on pos 63" do
|
38
|
-
installment_plan.to_cip[62..76].strip.should == '215'
|
39
|
-
end
|
40
|
-
it "first_installment_date should be 20120816 on pos 78" do
|
41
|
-
installment_plan.to_cip[77..86].strip.should == '20120816'
|
42
|
-
end
|
43
|
-
it "period should be Month on pos 88" do
|
44
|
-
installment_plan.to_cip[87..96].strip.should == 'Month'
|
45
|
-
end
|
46
|
-
it "interval should be 2 on pos 98" do
|
47
|
-
installment_plan.to_cip[97..99].strip.should == '2'
|
48
|
-
end
|
49
|
-
it "installment_fee should be 15 on pos 101" do
|
50
|
-
installment_plan.to_cip[100..114].strip.should == '15'
|
51
|
-
end
|
52
|
-
it "fixed_size_installment_amount should be 0 on pos 116" do
|
53
|
-
installment_plan.to_cip[115..115].strip.should == '0'
|
54
|
-
end
|
55
|
-
it "last_installment_date should be 20130416 on pos 117" do
|
56
|
-
installment_plan.to_cip[116..125].strip.should == '20130416'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CiPower
|
4
|
+
describe InstallmentPlan do
|
5
|
+
describe "Functions" do
|
6
|
+
let(:installment_plan) do
|
7
|
+
InstallmentPlan.new :group_no => '1',
|
8
|
+
:address_identification_debtee => '123456',
|
9
|
+
:address_identification_debtor => '987654',
|
10
|
+
:no_of_installments => '4',
|
11
|
+
:installment_amount => '215',
|
12
|
+
:first_installment_date => '20120816',
|
13
|
+
:period => 'Month',
|
14
|
+
:interval => '2',
|
15
|
+
:installment_fee => '15',
|
16
|
+
:fixed_size_installment_amount => '0',
|
17
|
+
:last_installment_date => '20130416'
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#to_cip" do
|
22
|
+
it "record_type should be 15 on pos 1" do
|
23
|
+
installment_plan.to_cip[0..1].should == '15'
|
24
|
+
end
|
25
|
+
it "group_no should be 1 on pos 3" do
|
26
|
+
installment_plan.to_cip[2..8].strip.should == '1'
|
27
|
+
end
|
28
|
+
it "address_identification_debtee should be 123456 on pos 10" do
|
29
|
+
installment_plan.to_cip[9..33].strip.should == '123456'
|
30
|
+
end
|
31
|
+
it "address_identification_debtor should be 987654 on pos 35" do
|
32
|
+
installment_plan.to_cip[34..58].strip.should == '987654'
|
33
|
+
end
|
34
|
+
it "no_of_installments should be 4 on pos 60" do
|
35
|
+
installment_plan.to_cip[59..61].strip.should == '4'
|
36
|
+
end
|
37
|
+
it "installment_amount should be 215 on pos 63" do
|
38
|
+
installment_plan.to_cip[62..76].strip.should == '215'
|
39
|
+
end
|
40
|
+
it "first_installment_date should be 20120816 on pos 78" do
|
41
|
+
installment_plan.to_cip[77..86].strip.should == '20120816'
|
42
|
+
end
|
43
|
+
it "period should be Month on pos 88" do
|
44
|
+
installment_plan.to_cip[87..96].strip.should == 'Month'
|
45
|
+
end
|
46
|
+
it "interval should be 2 on pos 98" do
|
47
|
+
installment_plan.to_cip[97..99].strip.should == '2'
|
48
|
+
end
|
49
|
+
it "installment_fee should be 15 on pos 101" do
|
50
|
+
installment_plan.to_cip[100..114].strip.should == '15'
|
51
|
+
end
|
52
|
+
it "fixed_size_installment_amount should be 0 on pos 116" do
|
53
|
+
installment_plan.to_cip[115..115].strip.should == '0'
|
54
|
+
end
|
55
|
+
it "last_installment_date should be 20130416 on pos 117" do
|
56
|
+
installment_plan.to_cip[116..125].strip.should == '20130416'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
61
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
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
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
-
|
8
|
-
require 'ci_power'
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
-
config.run_all_when_everything_filtered = true
|
13
|
-
config.filter_run :focus
|
14
|
-
|
15
|
-
# Run specs in random order to surface order dependencies. If you find an
|
16
|
-
# order dependency and want to debug it, you can fix the order by providing
|
17
|
-
# the seed, which is printed after each run.
|
18
|
-
# --seed 1234
|
19
|
-
config.order = 'random'
|
20
|
-
end
|
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
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'ci_power'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
17
|
+
# the seed, which is printed after each run.
|
18
|
+
# --seed 1234
|
19
|
+
config.order = 'random'
|
20
|
+
end
|
metadata
CHANGED
@@ -1,115 +1,109 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci_power
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.26
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.0.27
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Maik Duff
|
7
|
+
authors:
|
8
|
+
- Maik Duff
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
12
|
+
|
13
|
+
date: 2012-09-19 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rspec
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rake
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
62
49
|
description: Creates input files for CI-Power interface
|
63
|
-
email:
|
64
|
-
- md@impac.ch
|
50
|
+
email:
|
51
|
+
- md@impac.ch
|
65
52
|
executables: []
|
53
|
+
|
66
54
|
extensions: []
|
55
|
+
|
67
56
|
extra_rdoc_files: []
|
68
|
-
|
69
|
-
|
70
|
-
- lib/ci_power
|
71
|
-
- lib/ci_power/
|
72
|
-
- lib/ci_power/
|
73
|
-
- lib/ci_power/
|
74
|
-
- lib/ci_power/
|
75
|
-
- lib/ci_power/
|
76
|
-
- lib/ci_power/
|
77
|
-
- lib/ci_power/
|
78
|
-
- lib/ci_power/
|
79
|
-
- lib/ci_power/
|
80
|
-
- lib/ci_power/
|
81
|
-
- lib/ci_power.rb
|
82
|
-
- lib/
|
83
|
-
- lib/generators/ci_power/
|
84
|
-
- lib/
|
85
|
-
-
|
86
|
-
- spec/
|
87
|
-
- spec/
|
57
|
+
|
58
|
+
files:
|
59
|
+
- lib/ci_power.rb
|
60
|
+
- lib/ci_power/action.rb
|
61
|
+
- lib/ci_power/address.rb
|
62
|
+
- lib/ci_power/communication.rb
|
63
|
+
- lib/ci_power/debt_claim.rb
|
64
|
+
- lib/ci_power/debtor_data.rb
|
65
|
+
- lib/ci_power/dossier_data.rb
|
66
|
+
- lib/ci_power/export.rb
|
67
|
+
- lib/ci_power/installment_plan.rb
|
68
|
+
- lib/ci_power/open_appointment.rb
|
69
|
+
- lib/ci_power/process_data.rb
|
70
|
+
- lib/ci_power/record.rb
|
71
|
+
- lib/ci_power/version.rb
|
72
|
+
- lib/generators/ci_power/ci_power_generator.rb
|
73
|
+
- lib/generators/ci_power/templates/cip_export.rb
|
74
|
+
- lib/tasks/ci_power.rake
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
- spec/ci_power/export_spec.rb
|
77
|
+
- spec/ci_power/installment_plan_spec.rb
|
78
|
+
has_rdoc: true
|
88
79
|
homepage: http://www.impac.ch
|
89
80
|
licenses: []
|
81
|
+
|
90
82
|
post_install_message:
|
91
83
|
rdoc_options: []
|
92
|
-
|
93
|
-
|
94
|
-
|
84
|
+
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
88
|
none: false
|
96
|
-
requirements:
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: "0"
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
94
|
none: false
|
102
|
-
requirements:
|
103
|
-
|
104
|
-
|
105
|
-
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: "0"
|
106
99
|
requirements: []
|
100
|
+
|
107
101
|
rubyforge_project: ci_power
|
108
|
-
rubygems_version: 1.
|
102
|
+
rubygems_version: 1.5.1
|
109
103
|
signing_key:
|
110
104
|
specification_version: 3
|
111
105
|
summary: CI-Power Interface
|
112
|
-
test_files:
|
113
|
-
- spec/
|
114
|
-
- spec/ci_power/
|
115
|
-
- spec/
|
106
|
+
test_files:
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
- spec/ci_power/export_spec.rb
|
109
|
+
- spec/ci_power/installment_plan_spec.rb
|