singapore_cpf_calculator 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/singapore_cpf_calculator.rb +2 -0
- data/lib/singapore_cpf_calculator/age_group.rb +34 -11
- data/lib/singapore_cpf_calculator/base_calculator.rb +1 -0
- data/lib/singapore_cpf_calculator/requirements.rb +1 -0
- data/lib/singapore_cpf_calculator/requirements/group_55_years_and_below.rb +13 -0
- data/lib/singapore_cpf_calculator/version.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2016.rb +38 -0
- data/lib/singapore_cpf_calculator/year_2016/base.rb +17 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3.rb +33 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg.rb +35 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator.rb +32 -0
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3_spec.rb +10 -10
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg_spec.rb +10 -10
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg_spec.rb +11 -11
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg_spec.rb +11 -11
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg_spec.rb +11 -11
- data/spec/singapore_cpf_calculator/year_2015_spec.rb +3 -3
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016_spec.rb +187 -0
- data/spec/spec_helper.rb +3 -3
- metadata +82 -3
data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator_spec.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2016::SPR2GG::Age65UpContributionCalculator do
|
4
|
+
|
5
|
+
subject(:calculator) {
|
6
|
+
described_class.new ordinary_wages: ordinary_wages,
|
7
|
+
additional_wages: additional_wages
|
8
|
+
}
|
9
|
+
|
10
|
+
let(:result) { calculator.calculate }
|
11
|
+
|
12
|
+
let(:additional_wages) { 0.0 }
|
13
|
+
|
14
|
+
describe "#calculate" do
|
15
|
+
|
16
|
+
context "when the total wages amounts to 0.00" do
|
17
|
+
let(:ordinary_wages) { 0.00 }
|
18
|
+
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
|
19
|
+
end
|
20
|
+
|
21
|
+
context "when the total wages amounts to 50.00" do
|
22
|
+
let(:ordinary_wages) { 50.00 }
|
23
|
+
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when the total wages amounts to 50.01" do
|
27
|
+
let(:ordinary_wages) { 50.01 }
|
28
|
+
it { expect(result).to equal_cpf total: 2.00, employee: 0.00, employer: 2.00 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when the total wages amounts to 500.00" do
|
32
|
+
let(:ordinary_wages) { 500.00 }
|
33
|
+
it { expect(result).to equal_cpf total: 18.00, employee: 0.00, employer: 18.00 }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the total wages amounts to 500.01" do
|
37
|
+
let(:ordinary_wages) { 500.01 }
|
38
|
+
it { expect(result).to equal_cpf total: 18.00, employee: 0.00, employer: 18.00 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the total wages amounts to 749.99" do
|
42
|
+
let(:ordinary_wages) { 749.99 }
|
43
|
+
it { expect(result).to equal_cpf total: 64.00, employee: 37.00, employer: 27.00 }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when the total wages amounts to 750.00" do
|
47
|
+
let(:ordinary_wages) { 750.00 }
|
48
|
+
it { expect(result).to equal_cpf total: 64.00, employee: 37.00, employer: 27.00 }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when the total wages amounts to 5,000.00" do
|
52
|
+
let(:ordinary_wages) { 5_000.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 425.00, employee: 250.00, employer: 175.00 }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the total wages amounts to 10,000.00" do
|
57
|
+
let(:ordinary_wages) { 10_000.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 510.00, employee: 300.00, employer: 210.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2016::SPR2GG do
|
4
|
+
|
5
|
+
subject(:mod) { described_class }
|
6
|
+
|
7
|
+
describe ".applies_to?" do
|
8
|
+
let(:current_date) { Date.new(2016, 7, 1) }
|
9
|
+
let(:spr_start_date) { nil }
|
10
|
+
let(:employee_contribution_type) { nil }
|
11
|
+
let(:employer_contribution_type) { nil }
|
12
|
+
|
13
|
+
let(:result) {
|
14
|
+
mod.applies_to? status: status,
|
15
|
+
current_date: current_date,
|
16
|
+
spr_start_date: spr_start_date,
|
17
|
+
employee_contribution_type: employee_contribution_type,
|
18
|
+
employer_contribution_type: employer_contribution_type
|
19
|
+
}
|
20
|
+
|
21
|
+
context "when the employee is a citizen" do
|
22
|
+
let(:status) { "citizen" }
|
23
|
+
it { expect( result ).to be_falsey }
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when the employee is a permanent resident on their 3rd year" do
|
27
|
+
let(:status) { "permanent_resident" }
|
28
|
+
let(:spr_start_date) { Date.new(2014, 6, 20) }
|
29
|
+
it { expect( result ).to be_falsey }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when the employee is a permanent resident on their 2nd year" do
|
33
|
+
let(:status) { "permanent_resident" }
|
34
|
+
let(:spr_start_date) { Date.new(2015, 6, 20) }
|
35
|
+
|
36
|
+
context "for full employer and employee contribution type" do
|
37
|
+
let(:employee_contribution_type) { "full" }
|
38
|
+
let(:employer_contribution_type) { "full" }
|
39
|
+
it { expect( result ).to be_falsey }
|
40
|
+
end
|
41
|
+
|
42
|
+
context "for graduated employer and employee contribution type" do
|
43
|
+
let(:employee_contribution_type) { "graduated" }
|
44
|
+
let(:employer_contribution_type) { "graduated" }
|
45
|
+
it { expect( result ).to be_truthy }
|
46
|
+
end
|
47
|
+
|
48
|
+
context "for full employer and graduated employee contribution type" do
|
49
|
+
let(:employee_contribution_type) { "graduated" }
|
50
|
+
let(:employer_contribution_type) { "full" }
|
51
|
+
it { expect( result ).to be_falsey }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "when the employee is a permanent resident on their 1st year" do
|
56
|
+
let(:status) { "permanent_resident" }
|
57
|
+
let(:spr_start_date) { Date.new(2016, 6, 20) }
|
58
|
+
|
59
|
+
context "for full employer and employee contribution type" do
|
60
|
+
let(:employee_contribution_type) { "full" }
|
61
|
+
let(:employer_contribution_type) { "full" }
|
62
|
+
it { expect( result ).to be_falsey }
|
63
|
+
end
|
64
|
+
|
65
|
+
context "for graduated employer and employee contribution type" do
|
66
|
+
let(:employee_contribution_type) { "graduated" }
|
67
|
+
let(:employer_contribution_type) { "graduated" }
|
68
|
+
it { expect( result ).to be_falsey }
|
69
|
+
end
|
70
|
+
|
71
|
+
context "for full employer and graduated employee contribution type" do
|
72
|
+
let(:employee_contribution_type) { "graduated" }
|
73
|
+
let(:employer_contribution_type) { "full" }
|
74
|
+
it { expect( result ).to be_falsey }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "calculator_for" do
|
81
|
+
let(:calculator) { mod.calculator_for(current_date, birthdate: birthdate) }
|
82
|
+
let(:current_date) { Date.new(2016, 9, 15) }
|
83
|
+
|
84
|
+
context "when the employee's age is 55 or below" do
|
85
|
+
context "lower limit" do
|
86
|
+
let(:birthdate) { Date.new(1998, 8, 15) }
|
87
|
+
|
88
|
+
it {
|
89
|
+
expect( calculator ).
|
90
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age55BelowContributionCalculator
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
context "upper limit" do
|
95
|
+
let(:birthdate) { Date.new(1961, 9, 15) }
|
96
|
+
it {
|
97
|
+
expect( calculator ).
|
98
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age55BelowContributionCalculator
|
99
|
+
}
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context "when the employee's age is above 55 to 60" do
|
104
|
+
context "lower limit" do
|
105
|
+
let(:birthdate) { Date.new(1960, 8, 15) }
|
106
|
+
it {
|
107
|
+
expect( calculator ).
|
108
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age55To60ContributionCalculator
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
context "upper limit" do
|
113
|
+
let(:birthdate) { Date.new(1956, 9, 15) }
|
114
|
+
it {
|
115
|
+
expect( calculator ).
|
116
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age55To60ContributionCalculator
|
117
|
+
}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context "when the employee's age is above 60 to 65" do
|
122
|
+
context "lower limit" do
|
123
|
+
let(:birthdate) { Date.new(1955, 8, 15) }
|
124
|
+
it {
|
125
|
+
expect( calculator ).
|
126
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age60To65ContributionCalculator
|
127
|
+
}
|
128
|
+
end
|
129
|
+
|
130
|
+
context "upper limit" do
|
131
|
+
let(:birthdate) { Date.new(1951, 9, 15) }
|
132
|
+
it {
|
133
|
+
expect( calculator ).
|
134
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age60To65ContributionCalculator
|
135
|
+
}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "when the employee's age is 65 or above" do
|
140
|
+
context "lower limit" do
|
141
|
+
let(:birthdate) { Date.new(1950, 8, 15) }
|
142
|
+
it {
|
143
|
+
expect( calculator ).
|
144
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age65UpContributionCalculator
|
145
|
+
}
|
146
|
+
end
|
147
|
+
|
148
|
+
context "upper limit" do
|
149
|
+
let(:birthdate) { Date.new(1916, 8, 15) }
|
150
|
+
it {
|
151
|
+
expect( calculator ).
|
152
|
+
to be SingaporeCPFCalculator::Year2016::SPR2GG::Age65UpContributionCalculator
|
153
|
+
}
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2016 do
|
4
|
+
|
5
|
+
subject(:year_module) { described_class }
|
6
|
+
|
7
|
+
describe ".applies_to?" do
|
8
|
+
context "when the date falls into the year 2014" do
|
9
|
+
let(:date) { Date.new(2014, 11, 15) }
|
10
|
+
it { expect( year_module.applies_to? date ).to be_falsey }
|
11
|
+
end
|
12
|
+
|
13
|
+
context "when the date falls into the year 2015" do
|
14
|
+
let(:date) { Date.new(2015, 1, 1) }
|
15
|
+
it { expect( year_module.applies_to? date ).to be_falsey }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when the date falls into the year 2016" do
|
19
|
+
let(:date) { Date.new(2016, 1, 1) }
|
20
|
+
it { expect( year_module.applies_to? date ).to be_truthy }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe ".module_for_residency" do
|
25
|
+
|
26
|
+
let(:mod) {
|
27
|
+
year_module.module_for_residency status: status,
|
28
|
+
current_date: current_date,
|
29
|
+
spr_start_date: spr_start_date,
|
30
|
+
employee_contribution_type: employee_contribution_type,
|
31
|
+
employer_contribution_type: employer_contribution_type
|
32
|
+
}
|
33
|
+
|
34
|
+
let(:current_date) { Date.new(2016, 11, 15) }
|
35
|
+
let(:employee_contribution_type) { nil }
|
36
|
+
let(:employer_contribution_type) { nil }
|
37
|
+
|
38
|
+
context "when the employee is a citizen" do
|
39
|
+
let(:status) { "citizen" }
|
40
|
+
let(:spr_start_date) { nil }
|
41
|
+
|
42
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3 }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "when the employee is a permanent resident" do
|
46
|
+
let(:status) { "permanent_resident" }
|
47
|
+
|
48
|
+
context "when the employee is in their year 1 of permanent residency" do
|
49
|
+
context "on the start of the SPR1" do
|
50
|
+
let(:spr_start_date) { Date.new(2016, 6, 20) }
|
51
|
+
let(:current_date) { Date.new(2016, 6, 20) }
|
52
|
+
|
53
|
+
context "when the employer pays partial contribution" do
|
54
|
+
let(:employer_contribution_type) { "graduated" }
|
55
|
+
|
56
|
+
|
57
|
+
context "when employee pays partial" do
|
58
|
+
let(:employee_contribution_type) { "graduated" }
|
59
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR1GG }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "when the employer pays full contribution" do
|
64
|
+
let(:employer_contribution_type) { "full" }
|
65
|
+
|
66
|
+
context "when employee pays partial" do
|
67
|
+
let(:employee_contribution_type) { "graduated" }
|
68
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR1FG }
|
69
|
+
end
|
70
|
+
|
71
|
+
context "when employee pays full" do
|
72
|
+
let(:employee_contribution_type) { "full" }
|
73
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3 }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "on the end of the SPR1" do
|
79
|
+
let(:spr_start_date) { Date.new(2015, 6, 20) }
|
80
|
+
let(:current_date) { Date.new(2016, 6, 30) }
|
81
|
+
|
82
|
+
context "when the employer pays partial contribution" do
|
83
|
+
let(:employer_contribution_type) { "graduated" }
|
84
|
+
|
85
|
+
context "when employee pays partial" do
|
86
|
+
let(:employee_contribution_type) { "graduated" }
|
87
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR1GG }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context "when the employer pays full contribution" do
|
92
|
+
let(:employer_contribution_type) { "full" }
|
93
|
+
|
94
|
+
context "when employee pays partial" do
|
95
|
+
let(:employee_contribution_type) { "graduated" }
|
96
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR1FG }
|
97
|
+
end
|
98
|
+
|
99
|
+
context "when employee pays full" do
|
100
|
+
let(:employee_contribution_type) { "full" }
|
101
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3 }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "when the employee is in their year 2 of permanent residency" do
|
108
|
+
context "on the start of the SPR2" do
|
109
|
+
let(:spr_start_date) { Date.new(2015, 6, 20) }
|
110
|
+
let(:current_date) { Date.new(2016, 7, 1) }
|
111
|
+
|
112
|
+
context "when the employer pays partial contribution" do
|
113
|
+
let(:employer_contribution_type) { "graduated" }
|
114
|
+
|
115
|
+
|
116
|
+
context "when employee pays partial" do
|
117
|
+
let(:employee_contribution_type) { "graduated" }
|
118
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR2GG }
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context "when the employer pays full contribution" do
|
123
|
+
let(:employer_contribution_type) { "full" }
|
124
|
+
|
125
|
+
context "when employee pays partial" do
|
126
|
+
let(:employee_contribution_type) { "graduated" }
|
127
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR2FG }
|
128
|
+
end
|
129
|
+
|
130
|
+
context "when employee pays full" do
|
131
|
+
let(:employee_contribution_type) { "full" }
|
132
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3 }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context "on the end of the SPR2" do
|
138
|
+
let(:spr_start_date) { Date.new(2014, 6, 20) }
|
139
|
+
let(:current_date) { Date.new(2016, 6, 30) }
|
140
|
+
|
141
|
+
context "when the employer pays partial contribution" do
|
142
|
+
let(:employer_contribution_type) { "graduated" }
|
143
|
+
|
144
|
+
|
145
|
+
context "when employee pays partial" do
|
146
|
+
let(:employee_contribution_type) { "graduated" }
|
147
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR2GG }
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context "when the employer pays full contribution" do
|
152
|
+
let(:employer_contribution_type) { "full" }
|
153
|
+
|
154
|
+
context "when employee pays partial" do
|
155
|
+
let(:employee_contribution_type) { "graduated" }
|
156
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::SPR2FG }
|
157
|
+
end
|
158
|
+
|
159
|
+
context "when employee pays full" do
|
160
|
+
let(:employee_contribution_type) { "full" }
|
161
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3 }
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context "when the employee is in their year 3 of permanent residency" do
|
168
|
+
context "on the start of the SPR3" do
|
169
|
+
let(:spr_start_date) { Date.new(2014, 6, 20) }
|
170
|
+
let(:current_date) { Date.new(2016, 7, 1) }
|
171
|
+
|
172
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3 }
|
173
|
+
end
|
174
|
+
|
175
|
+
context "on SPR3 period" do
|
176
|
+
let(:spr_start_date) { Date.new(2012, 6, 20) }
|
177
|
+
let(:current_date) { Date.new(2016, 6, 30) }
|
178
|
+
|
179
|
+
it { expect(mod).to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3 }
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require "csv"
|
2
|
-
require "singapore_cpf_calculator"
|
3
1
|
require "codeclimate-test-reporter"
|
4
|
-
|
5
2
|
CodeClimate::TestReporter.start
|
6
3
|
|
4
|
+
require "csv"
|
5
|
+
require "singapore_cpf_calculator"
|
6
|
+
|
7
7
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
8
8
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
9
9
|
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: singapore_cpf_calculator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronald Maravilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/singapore_cpf_calculator/null_contribution_calculator.rb
|
104
104
|
- lib/singapore_cpf_calculator/requirements.rb
|
105
105
|
- lib/singapore_cpf_calculator/requirements/group_50_years_and_below.rb
|
106
|
+
- lib/singapore_cpf_calculator/requirements/group_55_years_and_below.rb
|
106
107
|
- lib/singapore_cpf_calculator/requirements/group_above_50_to_55_years.rb
|
107
108
|
- lib/singapore_cpf_calculator/requirements/group_above_55_to_60_years.rb
|
108
109
|
- lib/singapore_cpf_calculator/requirements/group_above_60_to_65_years.rb
|
@@ -178,6 +179,33 @@ files:
|
|
178
179
|
- lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator.rb
|
179
180
|
- lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_60_to_65_contribution_calculator.rb
|
180
181
|
- lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_65_up_contribution_calculator.rb
|
182
|
+
- lib/singapore_cpf_calculator/year_2016.rb
|
183
|
+
- lib/singapore_cpf_calculator/year_2016/base.rb
|
184
|
+
- lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3.rb
|
185
|
+
- lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator.rb
|
186
|
+
- lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb
|
187
|
+
- lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb
|
188
|
+
- lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator.rb
|
189
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_fg.rb
|
190
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator.rb
|
191
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator.rb
|
192
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator.rb
|
193
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator.rb
|
194
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_gg.rb
|
195
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator.rb
|
196
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator.rb
|
197
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator.rb
|
198
|
+
- lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator.rb
|
199
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_fg.rb
|
200
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator.rb
|
201
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator.rb
|
202
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator.rb
|
203
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator.rb
|
204
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_gg.rb
|
205
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator.rb
|
206
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator.rb
|
207
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator.rb
|
208
|
+
- lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator.rb
|
181
209
|
- lib/singapore_cpf_calculator/year_common.rb
|
182
210
|
- singapore_cpf_calculator.gemspec
|
183
211
|
- spec/acceptance/company_a.csv
|
@@ -246,6 +274,32 @@ files:
|
|
246
274
|
- spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_65_up_contribution_calculator_spec.rb
|
247
275
|
- spec/singapore_cpf_calculator/year_2015/spr_2_gg_spec.rb
|
248
276
|
- spec/singapore_cpf_calculator/year_2015_spec.rb
|
277
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb
|
278
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb
|
279
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb
|
280
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator_spec.rb
|
281
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb
|
282
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator_spec.rb
|
283
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb
|
284
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb
|
285
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator_spec.rb
|
286
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg_spec.rb
|
287
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator_spec.rb
|
288
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb
|
289
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb
|
290
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator_spec.rb
|
291
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg_spec.rb
|
292
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator_spec.rb
|
293
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb
|
294
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb
|
295
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator_spec.rb
|
296
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg_spec.rb
|
297
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator_spec.rb
|
298
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb
|
299
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb
|
300
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator_spec.rb
|
301
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg_spec.rb
|
302
|
+
- spec/singapore_cpf_calculator/year_2016_spec.rb
|
249
303
|
- spec/singapore_cpf_calculator_spec.rb
|
250
304
|
- spec/spec_helper.rb
|
251
305
|
homepage: https://github.com/payrollhero/singapore_cpf_calculator
|
@@ -339,6 +393,31 @@ test_files:
|
|
339
393
|
- spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_65_up_contribution_calculator_spec.rb
|
340
394
|
- spec/singapore_cpf_calculator/year_2015/spr_2_gg_spec.rb
|
341
395
|
- spec/singapore_cpf_calculator/year_2015_spec.rb
|
396
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb
|
397
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb
|
398
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb
|
399
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator_spec.rb
|
400
|
+
- spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb
|
401
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator_spec.rb
|
402
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb
|
403
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb
|
404
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator_spec.rb
|
405
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_fg_spec.rb
|
406
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator_spec.rb
|
407
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb
|
408
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb
|
409
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator_spec.rb
|
410
|
+
- spec/singapore_cpf_calculator/year_2016/spr_1_gg_spec.rb
|
411
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator_spec.rb
|
412
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb
|
413
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb
|
414
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator_spec.rb
|
415
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_fg_spec.rb
|
416
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator_spec.rb
|
417
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb
|
418
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb
|
419
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator_spec.rb
|
420
|
+
- spec/singapore_cpf_calculator/year_2016/spr_2_gg_spec.rb
|
421
|
+
- spec/singapore_cpf_calculator/year_2016_spec.rb
|
342
422
|
- spec/singapore_cpf_calculator_spec.rb
|
343
423
|
- spec/spec_helper.rb
|
344
|
-
has_rdoc:
|