singapore_cpf_calculator 1.4.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +6 -2
  3. data/.rubocop.yml +81 -0
  4. data/.rubocop_todo.yml +326 -0
  5. data/Gemfile +0 -1
  6. data/README.md +1 -0
  7. data/lib/singapore_cpf_calculator/version.rb +1 -1
  8. data/lib/singapore_cpf_calculator/year_2022.rb +2 -2
  9. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
  10. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
  11. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
  12. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
  13. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_70_up_contribution_calculator.rb +9 -0
  14. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/citizen_or_spr3_base.rb +8 -0
  15. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3.rb +40 -0
  16. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
  17. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
  18. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
  19. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
  20. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_70_up_contribution_calculator.rb +8 -0
  21. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg.rb +40 -0
  22. data/lib/singapore_cpf_calculator/year_2023/spr_1_gg.rb +29 -0
  23. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
  24. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
  25. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
  26. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
  27. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_70_up_contribution_calculator.rb +8 -0
  28. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg.rb +40 -0
  29. data/lib/singapore_cpf_calculator/year_2023/spr_2_gg.rb +29 -0
  30. data/lib/singapore_cpf_calculator/year_2023/year_2023.rb +35 -0
  31. data/lib/singapore_cpf_calculator/year_2023.rb +35 -0
  32. data/lib/singapore_cpf_calculator.rb +3 -1
  33. data/singapore_cpf_calculator.gemspec +3 -1
  34. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
  35. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
  36. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
  37. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
  38. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
  39. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3_spec.rb +242 -0
  40. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  41. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  42. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  43. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  44. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  45. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg_spec.rb +176 -0
  46. data/spec/singapore_cpf_calculator/year_2023/spr_1_gg_spec.rb +158 -0
  47. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  48. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  49. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  50. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  51. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  52. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg_spec.rb +176 -0
  53. data/spec/singapore_cpf_calculator/year_2023/spr_2_gg_spec.rb +158 -0
  54. data/spec/singapore_cpf_calculator/year_2023_spec.rb +193 -0
  55. data/spec/singapore_cpf_calculator_spec.rb +2 -1
  56. metadata +83 -131
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR1FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove60To65Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.11"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.16"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR1FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65~70.
6
+ class Age65To70ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove65To70Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.085"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.135"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR1FG
4
+ class Age70UpContributionCalculator < Year2022::SPR1FG::Age70UpContributionCalculator
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,40 @@
1
+ require_relative "spr_1_fg/age_55_below_contribution_calculator"
2
+ require_relative "spr_1_fg/age_55_to_60_contribution_calculator"
3
+ require_relative "spr_1_fg/age_60_to_65_contribution_calculator"
4
+ require_relative "spr_1_fg/age_65_to_70_contribution_calculator"
5
+ require_relative "spr_1_fg/age_70_up_contribution_calculator"
6
+
7
+ module SingaporeCPFCalculator
8
+ module Year2023
9
+
10
+ # For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
11
+ # employer contribution and graduated (G, partial) employee contribution
12
+ module SPR1FG
13
+
14
+ extend ResidencyModuleCommon
15
+ extend SPR1FGCommon
16
+
17
+ class << self
18
+
19
+ private
20
+
21
+ def has_70_up
22
+ true
23
+ end
24
+
25
+ def calculators
26
+ [
27
+ Age55BelowContributionCalculator,
28
+ Age55To60ContributionCalculator,
29
+ Age60To65ContributionCalculator,
30
+ Age65To70ContributionCalculator,
31
+ Age70UpContributionCalculator,
32
+ ]
33
+ end
34
+
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,29 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+
4
+ # For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
5
+ # employer contribution and graduated (G, partial) employee contribution
6
+ module SPR1GG
7
+
8
+ extend ResidencyModuleCommon
9
+ extend SPR1GGCommon
10
+
11
+ class << self
12
+
13
+ private
14
+
15
+ def calculators
16
+ [
17
+ SingaporeCPFCalculator::Year2022::SPR1GG::Age55BelowContributionCalculator,
18
+ SingaporeCPFCalculator::Year2022::SPR1GG::Age55To60ContributionCalculator,
19
+ SingaporeCPFCalculator::Year2022::SPR1GG::Age60To65ContributionCalculator,
20
+ SingaporeCPFCalculator::Year2022::SPR1GG::Age65UpContributionCalculator,
21
+ ]
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::SPR2FG::Age55BelowContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove55To60Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.145"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.27"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.125"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.375"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove60To65Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.11"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.185"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.075"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.225"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age65To70ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove65To70Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.085"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.135"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+ module SPR2FG
4
+ class Age70UpContributionCalculator < Year2022::SPR2FG::Age70UpContributionCalculator
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,40 @@
1
+ require_relative "spr_2_fg/age_55_below_contribution_calculator"
2
+ require_relative "spr_2_fg/age_55_to_60_contribution_calculator"
3
+ require_relative "spr_2_fg/age_60_to_65_contribution_calculator"
4
+ require_relative "spr_2_fg/age_65_to_70_contribution_calculator"
5
+ require_relative "spr_2_fg/age_70_up_contribution_calculator"
6
+
7
+ module SingaporeCPFCalculator
8
+ module Year2023
9
+
10
+ # For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
11
+ # employer contribution and graduated (G, partial) employee contribution
12
+ module SPR2FG
13
+
14
+ extend ResidencyModuleCommon
15
+ extend SPR2FGCommon
16
+
17
+ class << self
18
+
19
+ private
20
+
21
+ def has_70_up
22
+ true
23
+ end
24
+
25
+ def calculators
26
+ [
27
+ Age55BelowContributionCalculator,
28
+ Age55To60ContributionCalculator,
29
+ Age60To65ContributionCalculator,
30
+ Age65To70ContributionCalculator,
31
+ Age70UpContributionCalculator,
32
+ ]
33
+ end
34
+
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,29 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2023
3
+
4
+ # For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
5
+ # employer contribution and graduated (G, partial) employee contribution
6
+ module SPR2GG
7
+
8
+ extend ResidencyModuleCommon
9
+ extend SPR2GGCommon
10
+
11
+ class << self
12
+
13
+ private
14
+
15
+ def calculators
16
+ [
17
+ SingaporeCPFCalculator::Year2022::SPR2GG::Age55BelowContributionCalculator,
18
+ SingaporeCPFCalculator::Year2022::SPR2GG::Age55To60ContributionCalculator,
19
+ SingaporeCPFCalculator::Year2022::SPR2GG::Age60To65ContributionCalculator,
20
+ SingaporeCPFCalculator::Year2022::SPR2GG::Age65UpContributionCalculator,
21
+ ]
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+ end
@@ -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
@@ -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
@@ -119,7 +119,8 @@ module SingaporeCPFCalculator
119
119
  Year2014,
120
120
  Year2015,
121
121
  Year2016,
122
- Year2022
122
+ Year2022,
123
+ Year2023
123
124
  ]
124
125
  end
125
126
  end
@@ -144,3 +145,4 @@ require_relative "singapore_cpf_calculator/year_2014"
144
145
  require_relative "singapore_cpf_calculator/year_2015"
145
146
  require_relative "singapore_cpf_calculator/year_2016"
146
147
  require_relative "singapore_cpf_calculator/year_2022"
148
+ require_relative "singapore_cpf_calculator/year_2023"
@@ -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
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe SingaporeCPFCalculator::Year2023::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::Year2023::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: 73.00, employee: 0.00, employer: 73.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: 73.00, employee: 0.00, employer: 73.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: 221.00, employee: 112.00, employer: 109.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: 221.00, employee: 112.00, employer: 109.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_475.00, employee: 750.00, employer: 725.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_770.00, employee: 900.00, employer: 870.00 }
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe SingaporeCPFCalculator::Year2023::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: 6.00, employee: 0.00, employer: 6.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: 55.00, employee: 0.00, employer: 55.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: 55.00, employee: 0.00, employer: 55.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: 154.00, employee: 71.00, employer: 83.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: 154.00, employee: 71.00, employer: 83.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: 1025.00, employee: 475.00, employer: 550.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: 1230.00, employee: 570.00, employer: 660.00 }
59
+ end
60
+
61
+ end
62
+
63
+ end