singapore_cpf_calculator 1.2.0 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +15 -0
- data/README.md +14 -3
- data/lib/singapore_cpf_calculator.rb +26 -15
- data/lib/singapore_cpf_calculator/base_calculator.rb +45 -6
- data/lib/singapore_cpf_calculator/cpf_contribution.rb +14 -3
- data/lib/singapore_cpf_calculator/null_contribution_calculator.rb +4 -2
- data/lib/singapore_cpf_calculator/version.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2012_to_2015_aw_ceiling_module.rb +7 -0
- data/lib/singapore_cpf_calculator/year_2014/base.rb +1 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/citzen_or_spr3_base.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2015/base.rb +1 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3.rb +1 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_below_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_to_55_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_65_up_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
- data/lib/singapore_cpf_calculator/year_2016/base.rb +4 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3.rb +1 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
- data/singapore_cpf_calculator.gemspec +1 -2
- data/spec/acceptance/company_a.csv +1367 -1365
- data/spec/acceptance/company_a_spec.rb +6 -4
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_below_contribution_calculator_spec.rb +10 -10
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3_spec.rb +35 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +8 -8
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +82 -16
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator_spec.rb +8 -8
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +8 -8
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +8 -8
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator_spec.rb +8 -8
- data/spec/singapore_cpf_calculator_spec.rb +50 -2
- data/spec/spec_helper.rb +12 -10
- metadata +10 -21
- data/circle.yml +0 -3
@@ -16,16 +16,18 @@ describe "Company A" do
|
|
16
16
|
}
|
17
17
|
|
18
18
|
let(:expected_result) {
|
19
|
-
SingaporeCPFCalculator::CPFContribution.new total: BigDecimal
|
20
|
-
employee: BigDecimal
|
19
|
+
SingaporeCPFCalculator::CPFContribution.new total: BigDecimal(row["Total CPF$"]),
|
20
|
+
employee: BigDecimal(row["Employee CPF$"]),
|
21
|
+
ow_subject_to_cpf: BigDecimal(row["OW Subject To CPF"]),
|
22
|
+
aw_subject_to_cpf: additional_wages
|
21
23
|
}
|
22
24
|
|
23
25
|
let(:date) { row["Contribution Date"].to_date }
|
24
26
|
let(:birthdate) { row["Birthdate"].to_date }
|
25
27
|
let(:residency_status) { row["Residency Status"] }
|
26
28
|
let(:spr_start_date) { row["SPR Start Date"].try(:to_date) }
|
27
|
-
let(:ordinary_wages) { BigDecimal
|
28
|
-
let(:additional_wages) { BigDecimal
|
29
|
+
let(:ordinary_wages) { BigDecimal(row["Ordinary Wages"]) }
|
30
|
+
let(:additional_wages) { BigDecimal(row["Additional Wages"]) }
|
29
31
|
let(:employee_contribution_type) { row["Employee Contribution Type"] }
|
30
32
|
let(:employer_contribution_type) { row["Employer Contribution Type"] }
|
31
33
|
|
@@ -15,52 +15,52 @@ describe SingaporeCPFCalculator::Year2014::CitizenOrSPR3::Age50BelowContribution
|
|
15
15
|
|
16
16
|
context "when the total wages amounts to 0.00" do
|
17
17
|
let(:ordinary_wages) { 0.00 }
|
18
|
-
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
|
18
|
+
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00, ow: 0.0, aw: 0.0 }
|
19
19
|
end
|
20
20
|
|
21
21
|
context "when the total wages amounts to 50.00" do
|
22
22
|
let(:ordinary_wages) { 50.00 }
|
23
|
-
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
|
23
|
+
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00, ow: 50.0, aw: 0.0 }
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when the total wages amounts to 50.01" do
|
27
27
|
let(:ordinary_wages) { 50.01 }
|
28
|
-
it { expect(result).to equal_cpf total: 8.00, employee: 0.00, employer: 8.00 }
|
28
|
+
it { expect(result).to equal_cpf total: 8.00, employee: 0.00, employer: 8.00, ow: 50.01, aw: 0.0 }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "when the total wages amounts to 53.12" do
|
32
32
|
let(:ordinary_wages) { 53.12 }
|
33
|
-
it { expect(result).to equal_cpf total: 8.00, employee: 0.00, employer: 8.00 }
|
33
|
+
it { expect(result).to equal_cpf total: 8.00, employee: 0.00, employer: 8.00, ow: 53.12, aw: 0.0 }
|
34
34
|
end
|
35
35
|
|
36
36
|
context "when the total wages amounts to 501. 66" do
|
37
37
|
let(:ordinary_wages) { 501.66 }
|
38
|
-
it { expect(result).to equal_cpf total: 81.00, employee: 0.00, employer: 81.00 }
|
38
|
+
it { expect(result).to equal_cpf total: 81.00, employee: 0.00, employer: 81.00, ow: 501.66, aw: 0.0 }
|
39
39
|
end
|
40
40
|
|
41
41
|
context "when the total wages amounts to 501.67" do
|
42
42
|
let(:ordinary_wages) { 501.67 }
|
43
|
-
it { expect(result).to equal_cpf total: 81.00, employee: 1.00, employer: 80.00 }
|
43
|
+
it { expect(result).to equal_cpf total: 81.00, employee: 1.00, employer: 80.00, ow: 501.67, aw: 0.0 }
|
44
44
|
end
|
45
45
|
|
46
46
|
context "when the total wages amounts to 749.99" do
|
47
47
|
let(:ordinary_wages) { 749.99 }
|
48
|
-
it { expect(result).to equal_cpf total: 270.00, employee: 149.00, employer: 121.00 }
|
48
|
+
it { expect(result).to equal_cpf total: 270.00, employee: 149.00, employer: 121.00, ow: 749.99, aw: 0.0 }
|
49
49
|
end
|
50
50
|
|
51
51
|
context "when the total wages amounts to 750.00" do
|
52
52
|
let(:ordinary_wages) { 750.00 }
|
53
|
-
it { expect(result).to equal_cpf total: 270.00, employee: 150.00, employer: 120.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 270.00, employee: 150.00, employer: 120.00, ow: 750.00, aw: 0.0 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the total wages amounts to 5,000.00" do
|
57
57
|
let(:ordinary_wages) { 5_000.00 }
|
58
|
-
it { expect(result).to equal_cpf total: 1_800.00, employee: 1_000.00, employer: 800.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 1_800.00, employee: 1_000.00, employer: 800.00, ow: 5_000, aw: 0.0 }
|
59
59
|
end
|
60
60
|
|
61
61
|
context "when the total wages amounts to 10,000.00" do
|
62
62
|
let(:ordinary_wages) { 10_000.00 }
|
63
|
-
it { expect(result).to equal_cpf total: 1_800.00, employee: 1_000.00, employer: 800.00 }
|
63
|
+
it { expect(result).to equal_cpf total: 1_800.00, employee: 1_000.00, employer: 800.00, ow: 5_000, aw: 0.0 }
|
64
64
|
end
|
65
65
|
|
66
66
|
end
|
@@ -77,6 +77,41 @@ describe SingaporeCPFCalculator::Year2015::CitizenOrSPR3 do
|
|
77
77
|
|
78
78
|
end
|
79
79
|
|
80
|
+
describe "AW Ceiling" do
|
81
|
+
let(:calculator) { mod.calculator_for(current_date, birthdate: birthdate) }
|
82
|
+
let(:current_date) { Date.new(2015, 9, 15) }
|
83
|
+
let(:birthdate) { Date.new(1998, 8, 15) }
|
84
|
+
let(:status) { "permanent_resident" }
|
85
|
+
let(:spr_start_date) { Date.new(2015, 6, 20) }
|
86
|
+
let(:ordinary_wages) { 3_000 }
|
87
|
+
let(:additional_wages) { 2_000 }
|
88
|
+
let(:employee_contribution_type) { "full" }
|
89
|
+
let(:employer_contribution_type) { "full" }
|
90
|
+
subject(:result) {
|
91
|
+
calculator.calculate ordinary_wages: ordinary_wages,
|
92
|
+
additional_wages: additional_wages,
|
93
|
+
ytd_ow_subject_to_cpf: cumulative_ordinary
|
94
|
+
}
|
95
|
+
|
96
|
+
context "have earned far less than the AW ceiling cumulative" do
|
97
|
+
let(:cumulative_ordinary) { 2_000 }
|
98
|
+
|
99
|
+
it { is_expected.to equal_cpf total: 1850, employee: 1000, ow: 3_000, aw: 2000 }
|
100
|
+
end
|
101
|
+
|
102
|
+
context "earned 1k under the AW ceiling cumulative" do
|
103
|
+
let(:cumulative_ordinary) { 81_000 }
|
104
|
+
|
105
|
+
it { is_expected.to equal_cpf total: 1480, employee: 800, ow: 3_000, aw: 1000 }
|
106
|
+
end
|
107
|
+
|
108
|
+
context "has earned the wage ceiling" do
|
109
|
+
let(:cumulative_ordinary) { 86_000 }
|
110
|
+
|
111
|
+
it { is_expected.to equal_cpf total: 1110, employee: 600, ow: 3_000, aw: 0 }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
80
115
|
describe "calculator_for" do
|
81
116
|
let(:calculator) { mod.calculator_for(current_date, birthdate: birthdate) }
|
82
117
|
let(:current_date) { Date.new(2015, 9, 15) }
|
data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb
CHANGED
@@ -20,42 +20,42 @@ describe SingaporeCPFCalculator::Year2015::SPR2GG::Age55To60ContributionCalculat
|
|
20
20
|
|
21
21
|
context "when the total wages amounts to 50.00" do
|
22
22
|
let(:ordinary_wages) { 50.00 }
|
23
|
-
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
|
23
|
+
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00, ow: 50 }
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when the total wages amounts to 50.01" do
|
27
27
|
let(:ordinary_wages) { 50.01 }
|
28
|
-
it { expect(result).to equal_cpf total: 3.00, employee: 0.00, employer: 3.00 }
|
28
|
+
it { expect(result).to equal_cpf total: 3.00, employee: 0.00, employer: 3.00, ow: 50.01 }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "when the total wages amounts to 500.00" do
|
32
32
|
let(:ordinary_wages) { 500.00 }
|
33
|
-
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00 }
|
33
|
+
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00, ow: 500 }
|
34
34
|
end
|
35
35
|
|
36
36
|
context "when the total wages amounts to 500.01" do
|
37
37
|
let(:ordinary_wages) { 500.01 }
|
38
|
-
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00 }
|
38
|
+
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00, ow: 500.01 }
|
39
39
|
end
|
40
40
|
|
41
41
|
context "when the total wages amounts to 749.99" do
|
42
42
|
let(:ordinary_wages) { 749.99 }
|
43
|
-
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00 }
|
43
|
+
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00, ow: 749.99 }
|
44
44
|
end
|
45
45
|
|
46
46
|
context "when the total wages amounts to 750.00" do
|
47
47
|
let(:ordinary_wages) { 750.00 }
|
48
|
-
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00 }
|
48
|
+
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00, ow: 750 }
|
49
49
|
end
|
50
50
|
|
51
51
|
context "when the total wages amounts to 5,000.00" do
|
52
52
|
let(:ordinary_wages) { 5_000.00 }
|
53
|
-
it { expect(result).to equal_cpf total: 925.00, employee: 625.00, employer: 300.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 925.00, employee: 625.00, employer: 300.00, ow: 5_000 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the total wages amounts to 10,000.00" do
|
57
57
|
let(:ordinary_wages) { 10_000.00 }
|
58
|
-
it { expect(result).to equal_cpf total: 925.00, employee: 625.00, employer: 300.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 925.00, employee: 625.00, employer: 300.00, ow: 5000 }
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
@@ -20,13 +20,13 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
20
20
|
|
21
21
|
context "when the employee is a citizen" do
|
22
22
|
let(:status) { "citizen" }
|
23
|
-
it { expect(
|
23
|
+
it { expect(result).to be_truthy }
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when the employee is a permanent resident on their 3rd year" do
|
27
27
|
let(:status) { "permanent_resident" }
|
28
28
|
let(:spr_start_date) { Date.new(2014, 6, 20) }
|
29
|
-
it { expect(
|
29
|
+
it { expect(result).to be_truthy }
|
30
30
|
end
|
31
31
|
|
32
32
|
context "when the employee is a permanent resident on their 2nd year" do
|
@@ -36,19 +36,19 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
36
36
|
context "for full employer and employee contribution type" do
|
37
37
|
let(:employee_contribution_type) { "full" }
|
38
38
|
let(:employer_contribution_type) { "full" }
|
39
|
-
it { expect(
|
39
|
+
it { expect(result).to be_truthy }
|
40
40
|
end
|
41
41
|
|
42
42
|
context "for graduated employer and employee contribution type" do
|
43
43
|
let(:employee_contribution_type) { "graduated" }
|
44
44
|
let(:employer_contribution_type) { "graduated" }
|
45
|
-
it { expect(
|
45
|
+
it { expect(result).to be_falsey }
|
46
46
|
end
|
47
47
|
|
48
48
|
context "for full employer and graduated employee contribution type" do
|
49
49
|
let(:employee_contribution_type) { "graduated" }
|
50
50
|
let(:employer_contribution_type) { "full" }
|
51
|
-
it { expect(
|
51
|
+
it { expect(result).to be_falsey }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -59,24 +59,90 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
59
59
|
context "for full employer and employee contribution type" do
|
60
60
|
let(:employee_contribution_type) { "full" }
|
61
61
|
let(:employer_contribution_type) { "full" }
|
62
|
-
it { expect(
|
62
|
+
it { expect(result).to be_truthy }
|
63
63
|
end
|
64
64
|
|
65
65
|
context "for graduated employer and employee contribution type" do
|
66
66
|
let(:employee_contribution_type) { "graduated" }
|
67
67
|
let(:employer_contribution_type) { "graduated" }
|
68
|
-
it { expect(
|
68
|
+
it { expect(result).to be_falsey }
|
69
69
|
end
|
70
70
|
|
71
71
|
context "for full employer and graduated employee contribution type" do
|
72
72
|
let(:employee_contribution_type) { "graduated" }
|
73
73
|
let(:employer_contribution_type) { "full" }
|
74
|
-
it { expect(
|
74
|
+
it { expect(result).to be_falsey }
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
79
79
|
|
80
|
+
describe "AW Ceiling" do
|
81
|
+
let(:calculator) { mod.calculator_for(current_date, birthdate: birthdate) }
|
82
|
+
let(:current_date) { Date.new(2016, 9, 15) }
|
83
|
+
let(:birthdate) { Date.new(1998, 8, 15) }
|
84
|
+
let(:status) { "permanent_resident" }
|
85
|
+
let(:spr_start_date) { Date.new(2016, 6, 20) }
|
86
|
+
let(:ordinary_wages) { 3_000 }
|
87
|
+
let(:additional_wages) { 2_000 }
|
88
|
+
let(:employee_contribution_type) { "full" }
|
89
|
+
let(:employer_contribution_type) { "full" }
|
90
|
+
subject(:result) {
|
91
|
+
calculator.calculate ordinary_wages: ordinary_wages,
|
92
|
+
additional_wages: additional_wages,
|
93
|
+
ytd_ow_subject_to_cpf: cumulative_ordinary
|
94
|
+
}
|
95
|
+
|
96
|
+
context "have earned far less than the AW ceiling cumulative" do
|
97
|
+
let(:cumulative_ordinary) { 2_000 }
|
98
|
+
let(:expected_result) do
|
99
|
+
SingaporeCPFCalculator::CPFContribution.new(total: 1850.0,
|
100
|
+
employee: 1000.0,
|
101
|
+
ow_subject_to_cpf: ordinary_wages,
|
102
|
+
aw_subject_to_cpf: additional_wages)
|
103
|
+
end
|
104
|
+
|
105
|
+
it { is_expected.to equal_cpf total: 1850, employee: 1000, ow: ordinary_wages, aw: 2000 }
|
106
|
+
end
|
107
|
+
|
108
|
+
context "earned 1k under the AW ceiling cumulative" do
|
109
|
+
let(:cumulative_ordinary) { 98_000 }
|
110
|
+
it { is_expected.to equal_cpf total: 1480, employee: 400, ow: ordinary_wages, aw: 1000 }
|
111
|
+
end
|
112
|
+
|
113
|
+
context "has earned the wage ceiling" do
|
114
|
+
let(:cumulative_ordinary) { 105_000 }
|
115
|
+
it { is_expected.to equal_cpf total: 1110, employee: 300, ow: ordinary_wages, aw: 0 }
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "using estimated yearly ordinary wages" do
|
119
|
+
subject(:result) {
|
120
|
+
calculator.calculate ordinary_wages: ordinary_wages,
|
121
|
+
additional_wages: additional_wages,
|
122
|
+
ytd_ow_subject_to_cpf: cumulative_ordinary,
|
123
|
+
ytd_additional_wages: ytd_additional_wages,
|
124
|
+
estimated_yearly_ow: estimated_yearly_ow
|
125
|
+
}
|
126
|
+
let(:cumulative_ordinary) { 0 }
|
127
|
+
let(:ytd_additional_wages) { 0 }
|
128
|
+
|
129
|
+
context "estimated yearly earnings at the threshold" do
|
130
|
+
let(:estimated_yearly_ow) { 102_000 }
|
131
|
+
it { is_expected.to equal_cpf total: 1110, employee: 300, ow: ordinary_wages, aw: 0 }
|
132
|
+
end
|
133
|
+
|
134
|
+
context "estimated yearly earnings 1k below threshold" do
|
135
|
+
let(:estimated_yearly_ow) { 101_000 }
|
136
|
+
it { is_expected.to equal_cpf total: 1480, employee: 800, ow: ordinary_wages, aw: 1000 }
|
137
|
+
end
|
138
|
+
|
139
|
+
context "estimated yearly earnings 3k below threshold" do
|
140
|
+
let(:estimated_yearly_ow) { 99_000 }
|
141
|
+
it { is_expected.to equal_cpf total: 1850, employee: 1000, ow: ordinary_wages, aw: 2000 }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
80
146
|
describe "calculator_for" do
|
81
147
|
let(:calculator) { mod.calculator_for(current_date, birthdate: birthdate) }
|
82
148
|
let(:current_date) { Date.new(2016, 9, 15) }
|
@@ -86,7 +152,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
86
152
|
let(:birthdate) { Date.new(1998, 8, 15) }
|
87
153
|
|
88
154
|
it {
|
89
|
-
expect(
|
155
|
+
expect(calculator).
|
90
156
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age55BelowContributionCalculator
|
91
157
|
}
|
92
158
|
end
|
@@ -94,7 +160,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
94
160
|
context "upper limit" do
|
95
161
|
let(:birthdate) { Date.new(1961, 9, 15) }
|
96
162
|
it {
|
97
|
-
expect(
|
163
|
+
expect(calculator).
|
98
164
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age55BelowContributionCalculator
|
99
165
|
}
|
100
166
|
end
|
@@ -104,7 +170,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
104
170
|
context "lower limit" do
|
105
171
|
let(:birthdate) { Date.new(1960, 8, 15) }
|
106
172
|
it {
|
107
|
-
expect(
|
173
|
+
expect(calculator).
|
108
174
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age55To60ContributionCalculator
|
109
175
|
}
|
110
176
|
end
|
@@ -112,7 +178,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
112
178
|
context "upper limit" do
|
113
179
|
let(:birthdate) { Date.new(1956, 9, 15) }
|
114
180
|
it {
|
115
|
-
expect(
|
181
|
+
expect(calculator).
|
116
182
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age55To60ContributionCalculator
|
117
183
|
}
|
118
184
|
end
|
@@ -122,7 +188,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
122
188
|
context "lower limit" do
|
123
189
|
let(:birthdate) { Date.new(1955, 8, 15) }
|
124
190
|
it {
|
125
|
-
expect(
|
191
|
+
expect(calculator).
|
126
192
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age60To65ContributionCalculator
|
127
193
|
}
|
128
194
|
end
|
@@ -130,7 +196,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
130
196
|
context "upper limit" do
|
131
197
|
let(:birthdate) { Date.new(1951, 9, 15) }
|
132
198
|
it {
|
133
|
-
expect(
|
199
|
+
expect(calculator).
|
134
200
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age60To65ContributionCalculator
|
135
201
|
}
|
136
202
|
end
|
@@ -140,7 +206,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
140
206
|
context "lower limit" do
|
141
207
|
let(:birthdate) { Date.new(1950, 8, 15) }
|
142
208
|
it {
|
143
|
-
expect(
|
209
|
+
expect(calculator).
|
144
210
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age65UpContributionCalculator
|
145
211
|
}
|
146
212
|
end
|
@@ -148,7 +214,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
148
214
|
context "upper limit" do
|
149
215
|
let(:birthdate) { Date.new(1916, 8, 15) }
|
150
216
|
it {
|
151
|
-
expect(
|
217
|
+
expect(calculator).
|
152
218
|
to be SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age65UpContributionCalculator
|
153
219
|
}
|
154
220
|
end
|
data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator_spec.rb
CHANGED
@@ -20,42 +20,42 @@ describe SingaporeCPFCalculator::Year2016::SPR2GG::Age55BelowContributionCalcula
|
|
20
20
|
|
21
21
|
context "when the total wages amounts to 50.00" do
|
22
22
|
let(:ordinary_wages) { 50.00 }
|
23
|
-
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
|
23
|
+
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00, ow: 50 }
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when the total wages amounts to 50.01" do
|
27
27
|
let(:ordinary_wages) { 50.01 }
|
28
|
-
it { expect(result).to equal_cpf total: 5.00, employee: 0.00, employer: 5.00 }
|
28
|
+
it { expect(result).to equal_cpf total: 5.00, employee: 0.00, employer: 5.00, ow: 50.01 }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "when the total wages amounts to 500.00" do
|
32
32
|
let(:ordinary_wages) { 500.00 }
|
33
|
-
it { expect(result).to equal_cpf total: 45.00, employee: 0.00, employer: 45.00 }
|
33
|
+
it { expect(result).to equal_cpf total: 45.00, employee: 0.00, employer: 45.00, ow: 500 }
|
34
34
|
end
|
35
35
|
|
36
36
|
context "when the total wages amounts to 500.01" do
|
37
37
|
let(:ordinary_wages) { 500.01 }
|
38
|
-
it { expect(result).to equal_cpf total: 45.00, employee: 0.00, employer: 45.00 }
|
38
|
+
it { expect(result).to equal_cpf total: 45.00, employee: 0.00, employer: 45.00, ow: 500.01 }
|
39
39
|
end
|
40
40
|
|
41
41
|
context "when the total wages amounts to 749.99" do
|
42
42
|
let(:ordinary_wages) { 749.99 }
|
43
|
-
it { expect(result).to equal_cpf total: 180.00, employee: 112.00, employer: 68.00 }
|
43
|
+
it { expect(result).to equal_cpf total: 180.00, employee: 112.00, employer: 68.00, ow: 749.99 }
|
44
44
|
end
|
45
45
|
|
46
46
|
context "when the total wages amounts to 750.00" do
|
47
47
|
let(:ordinary_wages) { 750.00 }
|
48
|
-
it { expect(result).to equal_cpf total: 180.00, employee: 112.00, employer: 68.00 }
|
48
|
+
it { expect(result).to equal_cpf total: 180.00, employee: 112.00, employer: 68.00, ow: 750 }
|
49
49
|
end
|
50
50
|
|
51
51
|
context "when the total wages amounts to 5,000.00" do
|
52
52
|
let(:ordinary_wages) { 5_000.00 }
|
53
|
-
it { expect(result).to equal_cpf total: 1_200.00, employee: 750.00, employer: 450.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 1_200.00, employee: 750.00, employer: 450.00, ow: 5_000 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the total wages amounts to 10,000.00" do
|
57
57
|
let(:ordinary_wages) { 10_000.00 }
|
58
|
-
it { expect(result).to equal_cpf total: 1_440.00, employee: 900.00, employer: 540.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 1_440.00, employee: 900.00, employer: 540.00, ow: 6_000 }
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb
CHANGED
@@ -20,42 +20,42 @@ describe SingaporeCPFCalculator::Year2016::SPR2GG::Age55To60ContributionCalculat
|
|
20
20
|
|
21
21
|
context "when the total wages amounts to 50.00" do
|
22
22
|
let(:ordinary_wages) { 50.00 }
|
23
|
-
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
|
23
|
+
it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00, ow: 50 }
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when the total wages amounts to 50.01" do
|
27
27
|
let(:ordinary_wages) { 50.01 }
|
28
|
-
it { expect(result).to equal_cpf total: 3.00, employee: 0.00, employer: 3.00 }
|
28
|
+
it { expect(result).to equal_cpf total: 3.00, employee: 0.00, employer: 3.00, ow: 50.01 }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "when the total wages amounts to 500.00" do
|
32
32
|
let(:ordinary_wages) { 500.00 }
|
33
|
-
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00 }
|
33
|
+
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00, ow: 500 }
|
34
34
|
end
|
35
35
|
|
36
36
|
context "when the total wages amounts to 500.01" do
|
37
37
|
let(:ordinary_wages) { 500.01 }
|
38
|
-
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00 }
|
38
|
+
it { expect(result).to equal_cpf total: 30.00, employee: 0.00, employer: 30.00, ow: 500.01 }
|
39
39
|
end
|
40
40
|
|
41
41
|
context "when the total wages amounts to 749.99" do
|
42
42
|
let(:ordinary_wages) { 749.99 }
|
43
|
-
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00 }
|
43
|
+
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00, ow: 749.99 }
|
44
44
|
end
|
45
45
|
|
46
46
|
context "when the total wages amounts to 750.00" do
|
47
47
|
let(:ordinary_wages) { 750.00 }
|
48
|
-
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00 }
|
48
|
+
it { expect(result).to equal_cpf total: 139.00, employee: 93.00, employer: 46.00 , ow: 750}
|
49
49
|
end
|
50
50
|
|
51
51
|
context "when the total wages amounts to 5,000.00" do
|
52
52
|
let(:ordinary_wages) { 5_000.00 }
|
53
|
-
it { expect(result).to equal_cpf total: 925.00, employee: 625.00, employer: 300.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 925.00, employee: 625.00, employer: 300.00, ow: 5_000 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the total wages amounts to 10,000.00" do
|
57
57
|
let(:ordinary_wages) { 10_000.00 }
|
58
|
-
it { expect(result).to equal_cpf total: 1_110.00, employee: 750.00,
|
58
|
+
it { expect(result).to equal_cpf total: 1_110.00, employee: 750.00, ow: 6_000 }
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|