singapore_cpf_calculator 1.3.4 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +37 -0
- data/.rubocop.yml +81 -0
- data/.rubocop_todo.yml +326 -0
- data/README.md +2 -0
- data/lib/singapore_cpf_calculator/age_group.rb +27 -5
- data/lib/singapore_cpf_calculator/base_calculator.rb +14 -2
- data/lib/singapore_cpf_calculator/requirements/group_above_65_to_70_years.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements/group_above_70_years.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements.rb +3 -0
- data/lib/singapore_cpf_calculator/residency_module_common.rb +5 -1
- data/lib/singapore_cpf_calculator/version.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2016.rb +2 -2
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator.rb +12 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2022.rb +35 -0
- data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_70_up_contribution_calculator.rb +9 -0
- data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/citizen_or_spr3_base.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_70_up_contribution_calculator.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_1_fg.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_1_gg.rb +29 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_70_up_contribution_calculator.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_2_fg.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2023/spr_2_gg.rb +29 -0
- data/lib/singapore_cpf_calculator/year_2023/year_2023.rb +35 -0
- data/lib/singapore_cpf_calculator/year_2023.rb +35 -0
- data/lib/singapore_cpf_calculator.rb +10 -1
- data/singapore_cpf_calculator.gemspec +5 -3
- data/spec/singapore_cpf_calculator/age_group_spec.rb +15 -3
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +1 -1
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +2 -2
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +3 -3
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +1 -1
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3_spec.rb +242 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2022_spec.rb +192 -0
- data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3_spec.rb +242 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_1_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_1_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_2_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2023/spr_2_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2023_spec.rb +193 -0
- data/spec/singapore_cpf_calculator_spec.rb +58 -20
- data/spec/spec_helper.rb +6 -1
- metadata +148 -104
- data/.travis.yml +0 -15
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "year_2016/base"
|
2
|
+
require_relative "year_2023/citizen_or_spr_3"
|
3
|
+
require_relative "year_2023/spr_2_gg"
|
4
|
+
require_relative "year_2023/spr_2_fg"
|
5
|
+
require_relative "year_2023/spr_1_gg"
|
6
|
+
require_relative "year_2023/spr_1_fg"
|
7
|
+
|
8
|
+
module SingaporeCPFCalculator
|
9
|
+
# Contains the calculators that are used for determining CPF contribution for 2022.
|
10
|
+
module Year2023
|
11
|
+
class << self
|
12
|
+
include YearCommon
|
13
|
+
|
14
|
+
# @param [Date] date when the CPF contribution is to be calculated for.
|
15
|
+
# @return [true, false] true when the date's year is 2023 and later
|
16
|
+
def applies_to?(date)
|
17
|
+
date.year >= 2023
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def residency_modules
|
23
|
+
[
|
24
|
+
CitizenOrSPR3,
|
25
|
+
SPR2GG,
|
26
|
+
SPR2FG,
|
27
|
+
SPR1GG,
|
28
|
+
SPR1FG,
|
29
|
+
BeforeSPR,
|
30
|
+
]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -86,16 +86,22 @@ module SingaporeCPFCalculator
|
|
86
86
|
raise ArgumentError, "spr_start_date: must be set" if spr_start_date.nil?
|
87
87
|
if contribution_types_required?(date, spr_start_date)
|
88
88
|
if employee_contribution_type.nil?
|
89
|
+
# :nocov:
|
89
90
|
raise ArgumentError, "employee_contribution_type: must be set"
|
91
|
+
# :nocov:
|
90
92
|
end
|
91
93
|
if employer_contribution_type.nil?
|
94
|
+
# :nocov:
|
92
95
|
raise ArgumentError, "employer_contribution_type: must be set"
|
96
|
+
# :nocov:
|
93
97
|
end
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
97
101
|
unless ["citizen", "permanent_resident"].include? residency_status
|
102
|
+
# :nocov:
|
98
103
|
raise ArgumentError, "unsupported residency status: #{ residency_status }"
|
104
|
+
# :nocov:
|
99
105
|
end
|
100
106
|
end
|
101
107
|
|
@@ -112,7 +118,8 @@ module SingaporeCPFCalculator
|
|
112
118
|
[
|
113
119
|
Year2014,
|
114
120
|
Year2015,
|
115
|
-
Year2016
|
121
|
+
Year2016,
|
122
|
+
Year2022
|
116
123
|
]
|
117
124
|
end
|
118
125
|
end
|
@@ -136,3 +143,5 @@ require_relative 'singapore_cpf_calculator/year_2012_to_2015_aw_ceiling_module'
|
|
136
143
|
require_relative "singapore_cpf_calculator/year_2014"
|
137
144
|
require_relative "singapore_cpf_calculator/year_2015"
|
138
145
|
require_relative "singapore_cpf_calculator/year_2016"
|
146
|
+
require_relative "singapore_cpf_calculator/year_2022"
|
147
|
+
require_relative "singapore_cpf_calculator/year_2023"
|
@@ -6,8 +6,8 @@ require 'singapore_cpf_calculator/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "singapore_cpf_calculator"
|
8
8
|
spec.version = SingaporeCPFCalculator::VERSION
|
9
|
-
spec.authors = ["Ronald Maravilla"]
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Ronald Maravilla", "Mathieu Jobin", "Pete Henchaw"]
|
10
|
+
spec.email = ["support@payrollhero.com"]
|
11
11
|
spec.summary = "A Singapore's Central Provident Fund (CPF) contributions calculator."
|
12
12
|
spec.description = "A Singapore's Central Provident Fund (CPF) contributions calculator."
|
13
13
|
spec.homepage = "https://github.com/payrollhero/singapore_cpf_calculator"
|
@@ -15,12 +15,14 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
18
|
spec.require_paths = ["lib"]
|
20
19
|
|
21
20
|
spec.add_development_dependency "bundler", ">= 1.6"
|
22
21
|
spec.add_development_dependency "rake"
|
23
22
|
spec.add_development_dependency "rspec"
|
23
|
+
spec.add_development_dependency "rubocop"
|
24
|
+
spec.add_development_dependency "simplecov"
|
24
25
|
|
25
26
|
spec.add_dependency "activesupport"
|
27
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
26
28
|
end
|
@@ -3,7 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe SingaporeCPFCalculator::AgeGroup do
|
4
4
|
|
5
5
|
describe "#get" do
|
6
|
-
let(:
|
6
|
+
let(:has_70_up) { false }
|
7
|
+
let(:age_group) { described_class.get current_date, birthdate: birthdate, has_70_up: has_70_up }
|
7
8
|
|
8
9
|
context "born 1950-06-15" do
|
9
10
|
let(:birthdate) { Date.new(1950, 6, 15) }
|
@@ -55,11 +56,22 @@ describe SingaporeCPFCalculator::AgeGroup do
|
|
55
56
|
|
56
57
|
context "when age 100, on the same month of the birth date" do
|
57
58
|
let(:current_date) { Date.new(2050, 6, 30) }
|
58
|
-
|
59
|
+
let(:has_70_up) { true }
|
60
|
+
it { expect(age_group).to eq :group_above_70_years }
|
59
61
|
end
|
60
62
|
|
61
63
|
end
|
62
64
|
|
65
|
+
context "born 1957-06-15" do
|
66
|
+
let(:birthdate) { Date.new(1957, 6, 15) }
|
67
|
+
let(:has_70_up) { true }
|
68
|
+
|
69
|
+
context "when age 65, on the month after the birth month" do
|
70
|
+
let(:current_date) { Date.new(2022, 7, 1) }
|
71
|
+
it { expect(age_group).to eq :group_above_65_to_70_years }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
63
75
|
end
|
64
|
-
|
76
|
+
|
65
77
|
end
|
@@ -50,7 +50,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age55To60ContributionC
|
|
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_300.00, employee: 650.00, employer:
|
53
|
+
it { expect(result).to equal_cpf total: 1_300.00, employee: 650.00, employer: 650.00 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the total wages amounts to 10,000.00" do
|
@@ -40,12 +40,12 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age60To65ContributionC
|
|
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: 124.00, employee: 56.00, employer:
|
43
|
+
it { expect(result).to equal_cpf total: 124.00, employee: 56.00, employer: 68.00 }
|
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: 124.00, employee: 56.00, employer:
|
48
|
+
it { expect(result).to equal_cpf total: 124.00, employee: 56.00, employer: 68.00 }
|
49
49
|
end
|
50
50
|
|
51
51
|
context "when the total wages amounts to 5,000.00" do
|
@@ -107,12 +107,12 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
107
107
|
|
108
108
|
context "earned 1k under the AW ceiling cumulative" do
|
109
109
|
let(:cumulative_ordinary) { 98_000 }
|
110
|
-
it { is_expected.to equal_cpf total: 1480, employee:
|
110
|
+
it { is_expected.to equal_cpf total: 1480, employee: 800, ow: ordinary_wages, aw: 1000 }
|
111
111
|
end
|
112
112
|
|
113
113
|
context "has earned the wage ceiling" do
|
114
114
|
let(:cumulative_ordinary) { 105_000 }
|
115
|
-
it { is_expected.to equal_cpf total: 1110, employee:
|
115
|
+
it { is_expected.to equal_cpf total: 1110, employee: 600, ow: ordinary_wages, aw: 0 }
|
116
116
|
end
|
117
117
|
|
118
118
|
describe "using estimated yearly ordinary wages" do
|
@@ -128,7 +128,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
|
|
128
128
|
|
129
129
|
context "estimated yearly earnings at the threshold" do
|
130
130
|
let(:estimated_yearly_ow) { 102_000 }
|
131
|
-
it { is_expected.to equal_cpf total: 1110, employee:
|
131
|
+
it { is_expected.to equal_cpf total: 1110, employee: 600, ow: ordinary_wages, aw: 0 }
|
132
132
|
end
|
133
133
|
|
134
134
|
context "estimated yearly earnings 1k below threshold" do
|
data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe SingaporeCPFCalculator::Year2016::SPR1FG::Age55To60ContributionCalculat
|
|
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: 7.00, employee: 0.00, employer:
|
28
|
+
it { expect(result).to equal_cpf total: 7.00, employee: 0.00, employer: 7.00 }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "when the total wages amounts to 500.00" do
|
data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb
CHANGED
@@ -50,7 +50,7 @@ describe SingaporeCPFCalculator::Year2016::SPR1FG::Age60To65ContributionCalculat
|
|
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: 700.00, employee: 250.00, employer:
|
53
|
+
it { expect(result).to equal_cpf total: 700.00, employee: 250.00, employer: 450.00 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the total wages amounts to 10,000.00" do
|
data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb
CHANGED
@@ -50,7 +50,7 @@ describe SingaporeCPFCalculator::Year2016::SPR2FG::Age60To65ContributionCalculat
|
|
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: 825.00, employee: 375.00, employer:
|
53
|
+
it { expect(result).to equal_cpf total: 825.00, employee: 375.00, employer: 450.00 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the total wages amounts to 10,000.00" do
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2022::CitizenOrSPR3::Age55BelowContributionCalculator 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: 9.00, employee: 0.00, employer: 9.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: 85.00, employee: 0.00, employer: 85.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: 85.00, employee: 0.00, employer: 85.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: 277.00, employee: 149.00, employer: 128.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: 278.00, employee: 150.00, employer: 128.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_850.00, employee: 1_000.00, employer: 850.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: 2_220.00, employee: 1_200.00, employer: 1_020.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2022::CitizenOrSPR3::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: 7.00, employee: 0.00, employer: 7.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: 70.00, employee: 0.00, employer: 70.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: 70.00, employee: 0.00, employer: 70.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: 210.00, employee: 104.00, employer: 106.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: 210.00, employee: 105.00, employer: 105.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_400.00, employee: 700.00, employer: 700.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_680.00, employee: 840.00, employer: 840.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2022::CitizenOrSPR3::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: 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: 50.00, employee: 0.00, employer: 50.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: 50.00, employee: 0.00, employer: 50.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: 63.00, employer: 76.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: 63.00, employer: 76.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: 425.00, employer: 500.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: 1110.00, employee: 510.00, employer: 600.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2022::CitizenOrSPR3::Age65To70ContributionCalculator 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: 4.00, employee: 0.00, employer: 4.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: 40.00, employee: 0.00, employer: 40.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: 40.00, employee: 0.00, employer: 40.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: 105.00, employee: 44.00, employer: 61.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: 105.00, employee: 45.00, employer: 60.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: 700.00, employee: 300.00, employer: 400.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: 840.00, employee: 360.00, employer: 480.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2022::CitizenOrSPR3::Age70UpContributionCalculator 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: 4.00, employee: 0.00, employer: 4.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: 38.00, employee: 0.00, employer: 38.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: 38.00, employee: 0.00, employer: 38.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: 94.00, employee: 37.00, employer: 57.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: 94.00, employee: 37.00, employer: 57.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: 625.00, employee: 250.00, employer: 375.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: 750.00, employee: 300.00, employer: 450.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|