singapore_cpf_calculator 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +97 -0
- data/Rakefile +2 -0
- data/circle.yml +3 -0
- data/lib/singapore_cpf_calculator.rb +125 -0
- data/lib/singapore_cpf_calculator/age_group.rb +71 -0
- data/lib/singapore_cpf_calculator/base_calculator.rb +114 -0
- data/lib/singapore_cpf_calculator/before_spr.rb +36 -0
- data/lib/singapore_cpf_calculator/citizen_or_spr_3_common.rb +27 -0
- data/lib/singapore_cpf_calculator/cpf_contribution.rb +28 -0
- data/lib/singapore_cpf_calculator/null_contribution_calculator.rb +17 -0
- data/lib/singapore_cpf_calculator/requirements.rb +10 -0
- data/lib/singapore_cpf_calculator/requirements/group_50_years_and_below.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements/group_above_50_to_55_years.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements/group_above_55_to_60_years.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements/group_above_60_to_65_years.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements/group_above_65_years.rb +13 -0
- data/lib/singapore_cpf_calculator/residency_module_common.rb +12 -0
- data/lib/singapore_cpf_calculator/spr_1_fg_common.rb +26 -0
- data/lib/singapore_cpf_calculator/spr_1_gg_common.rb +26 -0
- data/lib/singapore_cpf_calculator/spr_2_fg_common.rb +26 -0
- data/lib/singapore_cpf_calculator/spr_2_gg_common.rb +26 -0
- data/lib/singapore_cpf_calculator/spr_status.rb +52 -0
- data/lib/singapore_cpf_calculator/version.rb +3 -0
- data/lib/singapore_cpf_calculator/year_2014.rb +37 -0
- data/lib/singapore_cpf_calculator/year_2014/base.rb +17 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3.rb +35 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_to_55_contribution_calculator.rb +33 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_fg.rb +36 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_50_below_contribution_calculator.rb +33 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_50_to_55_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_gg.rb +36 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_50_to_55_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_55_to_60_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_1_gg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_fg.rb +36 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_50_to_55_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_gg.rb +36 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_50_to_55_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2014/spr_2_gg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015.rb +38 -0
- data/lib/singapore_cpf_calculator/year_2015/base.rb +17 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3.rb +35 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_to_55_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_fg.rb +37 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_50_to_55_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_gg.rb +36 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_50_to_55_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_55_to_60_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_fg.rb +36 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_50_to_55_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_gg.rb +36 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_to_55_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2015/spr_2_gg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_common.rb +29 -0
- data/singapore_cpf_calculator.gemspec +27 -0
- data/spec/acceptance/company_a.csv +1365 -0
- data/spec/acceptance/company_a_spec.rb +36 -0
- data/spec/singapore_cpf_calculator/age_group_spec.rb +65 -0
- data/spec/singapore_cpf_calculator/spr_status_spec.rb +48 -0
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_below_contribution_calculator_spec.rb +68 -0
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_to_55_contribution_calculator_spec.rb +68 -0
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +68 -0
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +68 -0
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_65_up_contribution_calculator_spec.rb +68 -0
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_fg/age_50_below_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_fg/age_50_to_55_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_fg/age_65_up_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_gg/age_50_below_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_gg/age_50_to_55_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_gg/age_65_up_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_1_gg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_fg/age_50_below_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_fg/age_50_to_55_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_fg/age_65_up_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_gg/age_50_below_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_gg/age_50_to_55_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_gg/age_65_up_contribution_calculator_spec.rb +73 -0
- data/spec/singapore_cpf_calculator/year_2014/spr_2_gg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2014_spec.rb +183 -0
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_to_55_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg/age_50_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg/age_50_to_55_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg/age_50_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg/age_50_to_55_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg/age_50_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg/age_50_to_55_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_to_55_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2015_spec.rb +187 -0
- data/spec/singapore_cpf_calculator_spec.rb +48 -0
- data/spec/spec_helper.rb +115 -0
- metadata +344 -0
@@ -0,0 +1,176 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2015::SPR2FG do
|
4
|
+
|
5
|
+
subject(:mod) { described_class }
|
6
|
+
|
7
|
+
describe ".applies_to?" do
|
8
|
+
let(:current_date) { Date.new(2015, 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(2013, 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(2014, 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_falsey }
|
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_truthy }
|
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(2015, 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(2014, 9, 15) }
|
83
|
+
|
84
|
+
context "when the employee's age is 50 or below" do
|
85
|
+
context "lower limit" do
|
86
|
+
let(:birthdate) { Date.new(1996, 8, 15) }
|
87
|
+
|
88
|
+
it {
|
89
|
+
expect( calculator ).
|
90
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age50BelowContributionCalculator
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
context "upper limit" do
|
95
|
+
let(:birthdate) { Date.new(1964, 9, 15) }
|
96
|
+
it {
|
97
|
+
expect( calculator ).
|
98
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age50BelowContributionCalculator
|
99
|
+
}
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context "when the employee's age is above 50 to 55" do
|
104
|
+
context "lower limit" do
|
105
|
+
let(:birthdate) { Date.new(1963, 8, 15) }
|
106
|
+
it {
|
107
|
+
expect( calculator ).
|
108
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age50To55ContributionCalculator
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
context "upper limit" do
|
113
|
+
let(:birthdate) { Date.new(1959, 9, 15) }
|
114
|
+
it {
|
115
|
+
expect( calculator ).
|
116
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age50To55ContributionCalculator
|
117
|
+
}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context "when the employee's age is above 55 to 60" do
|
122
|
+
context "lower limit" do
|
123
|
+
let(:birthdate) { Date.new(1958, 8, 15) }
|
124
|
+
it {
|
125
|
+
expect( calculator ).
|
126
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age55To60ContributionCalculator
|
127
|
+
}
|
128
|
+
end
|
129
|
+
|
130
|
+
context "upper limit" do
|
131
|
+
let(:birthdate) { Date.new(1954, 9, 15) }
|
132
|
+
it {
|
133
|
+
expect( calculator ).
|
134
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age55To60ContributionCalculator
|
135
|
+
}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "when the employee's age is above 60 to 65" do
|
140
|
+
context "lower limit" do
|
141
|
+
let(:birthdate) { Date.new(1953, 8, 15) }
|
142
|
+
it {
|
143
|
+
expect( calculator ).
|
144
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age60To65ContributionCalculator
|
145
|
+
}
|
146
|
+
end
|
147
|
+
|
148
|
+
context "upper limit" do
|
149
|
+
let(:birthdate) { Date.new(1949, 9, 15) }
|
150
|
+
it {
|
151
|
+
expect( calculator ).
|
152
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age60To65ContributionCalculator
|
153
|
+
}
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
context "when the employee's age is 65 or above" do
|
158
|
+
context "lower limit" do
|
159
|
+
let(:birthdate) { Date.new(1948, 8, 15) }
|
160
|
+
it {
|
161
|
+
expect( calculator ).
|
162
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age65UpContributionCalculator
|
163
|
+
}
|
164
|
+
end
|
165
|
+
|
166
|
+
context "upper limit" do
|
167
|
+
let(:birthdate) { Date.new(1914, 8, 15) }
|
168
|
+
it {
|
169
|
+
expect( calculator ).
|
170
|
+
to be SingaporeCPFCalculator::Year2015::SPR2FG::Age65UpContributionCalculator
|
171
|
+
}
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_below_contribution_calculator_spec.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2015::SPR2GG::Age50BelowContributionCalculator 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: 5.00, employee: 0.00, employer: 5.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: 45.00, employee: 0.00, employer: 45.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: 45.00, employee: 0.00, employer: 45.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: 180.00, employee: 112.00, employer: 68.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: 180.00, employee: 112.00, employer: 68.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: 1_200.00, employee: 750.00, employer: 450.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: 1_200.00, employee: 750.00, employer: 450.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_50_to_55_contribution_calculator_spec.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2015::SPR2GG::Age50To55ContributionCalculator 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: 5.00, employee: 0.00, employer: 5.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: 45.00, employee: 0.00, employer: 45.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: 45.00, employee: 0.00, employer: 45.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: 180.00, employee: 112.00, employer: 68.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: 180.00, employee: 112.00, employer: 68.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: 1_200.00, employee: 750.00, employer: 450.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: 1_200.00, employee: 750.00, employer: 450.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2015::SPR2GG::Age55To60ContributionCalculator 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: 3.00, employee: 0.00, employer: 3.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: 30.00, employee: 0.00, employer: 30.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: 30.00, employee: 0.00, employer: 30.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: 139.00, employee: 93.00, employer: 46.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: 139.00, employee: 93.00, employer: 46.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: 925.00, employee: 625.00, employer: 300.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: 925.00, employee: 625.00, employer: 300.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2015::SPR2GG::Age60To65ContributionCalculator 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: 82.00, employee: 56.00, employer: 26.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: 83.00, employee: 56.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: 550.00, employee: 375.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: 550.00, employee: 375.00, employer: 175.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_65_up_contribution_calculator_spec.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2015::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: 425.00, employee: 250.00, employer: 175.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|