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,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Company A" do
|
4
|
+
|
5
|
+
CSV.foreach('spec/acceptance/company_a.csv', headers: true) do |row|
|
6
|
+
context "test: #{row.to_a}" do
|
7
|
+
let(:result) {
|
8
|
+
SingaporeCPFCalculator.calculate date: date,
|
9
|
+
birthdate: birthdate,
|
10
|
+
residency_status: residency_status,
|
11
|
+
spr_start_date: spr_start_date,
|
12
|
+
ordinary_wages: ordinary_wages,
|
13
|
+
additional_wages: additional_wages,
|
14
|
+
employee_contribution_type: employee_contribution_type,
|
15
|
+
employer_contribution_type: employer_contribution_type
|
16
|
+
}
|
17
|
+
|
18
|
+
let(:expected_result) {
|
19
|
+
SingaporeCPFCalculator::CPFContribution.new total: BigDecimal.new(row["Total CPF$"]),
|
20
|
+
employee: BigDecimal.new(row["Employee CPF$"])
|
21
|
+
}
|
22
|
+
|
23
|
+
let(:date) { row["Contribution Date"].to_date }
|
24
|
+
let(:birthdate) { row["Birthdate"].to_date }
|
25
|
+
let(:residency_status) { row["Residency Status"] }
|
26
|
+
let(:spr_start_date) { row["SPR Start Date"].try(:to_date) }
|
27
|
+
let(:ordinary_wages) { BigDecimal.new row["Ordinary Wages"] }
|
28
|
+
let(:additional_wages) { BigDecimal.new row["Additional Wages"] }
|
29
|
+
let(:employee_contribution_type) { row["Employee Contribution Type"] }
|
30
|
+
let(:employer_contribution_type) { row["Employer Contribution Type"] }
|
31
|
+
|
32
|
+
it { expect(result).to eq expected_result }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::AgeGroup do
|
4
|
+
|
5
|
+
describe "#get" do
|
6
|
+
let(:age_group) { described_class.get current_date, birthdate: birthdate }
|
7
|
+
|
8
|
+
context "born 1950-06-15" do
|
9
|
+
let(:birthdate) { Date.new(1950, 6, 15) }
|
10
|
+
|
11
|
+
context "when age 49, on the birth month before the birth date" do
|
12
|
+
let(:current_date) { Date.new(2000, 6, 1) }
|
13
|
+
it { expect(age_group).to eq :group_50_years_and_below }
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when age 50, on the birth month after the birth date" do
|
17
|
+
let(:current_date) { Date.new(2000, 6, 30) }
|
18
|
+
it { expect(age_group).to eq :group_50_years_and_below }
|
19
|
+
end
|
20
|
+
|
21
|
+
context "when age 50, on the month after the birth month" do
|
22
|
+
let(:current_date) { Date.new(2000, 7, 1) }
|
23
|
+
it { expect(age_group).to eq :group_above_50_to_55_years }
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when age 55, on the same month as the birth month" do
|
27
|
+
let(:current_date) { Date.new(2005, 6, 30) }
|
28
|
+
it { expect(age_group).to eq :group_above_50_to_55_years }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when age 55, on the birth month after the birth date" do
|
32
|
+
let(:current_date) { Date.new(2005, 7, 1) }
|
33
|
+
it { expect(age_group).to eq :group_above_55_to_60_years }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when age 60, on the same month of the birth month" do
|
37
|
+
let(:current_date) { Date.new(2010, 6, 30) }
|
38
|
+
it { expect(age_group).to eq :group_above_55_to_60_years }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when age 60, on the birth month after the birth date" do
|
42
|
+
let(:current_date) { Date.new(2010, 7, 1) }
|
43
|
+
it { expect(age_group).to eq :group_above_60_to_65_years }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when age 65, on the same month of the birth month" do
|
47
|
+
let(:current_date) { Date.new(2015, 6, 30) }
|
48
|
+
it { expect(age_group).to eq :group_above_60_to_65_years }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when age 65, on the month after the birth month" do
|
52
|
+
let(:current_date) { Date.new(2015, 7, 1) }
|
53
|
+
it { expect(age_group).to eq :group_above_65_years }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when age 100, on the same month of the birth date" do
|
57
|
+
let(:current_date) { Date.new(2050, 6, 30) }
|
58
|
+
it { expect(age_group).to eq :group_above_65_years }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::SPRStatus do
|
4
|
+
|
5
|
+
describe ".get" do
|
6
|
+
|
7
|
+
subject(:status) { described_class.get current_date, status_start_date: status_start_date}
|
8
|
+
|
9
|
+
let(:status_start_date) { Date.new(2013, 6, 20) }
|
10
|
+
|
11
|
+
context "when the permanent residency is on the start of 1st year" do
|
12
|
+
let(:current_date) { Date.new(2013, 6, 20) }
|
13
|
+
|
14
|
+
it { expect(status).to eq :SPR1 }
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when the permanent residency is on the end of 1st year" do
|
18
|
+
let(:current_date) { Date.new(2014, 6, 30) }
|
19
|
+
|
20
|
+
it { expect(status).to eq :SPR1 }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when the permanent residency is on the start of 2nd year" do
|
24
|
+
let(:current_date) { Date.new(2014, 7, 1) }
|
25
|
+
|
26
|
+
it { expect(status).to eq :SPR2 }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when the permanent residency is on the end of 2nd year" do
|
30
|
+
let(:current_date) { Date.new(2015, 6, 30) }
|
31
|
+
|
32
|
+
it { expect(status).to eq :SPR2 }
|
33
|
+
end
|
34
|
+
|
35
|
+
context "when the permanent residency is on the start of 3rd year" do
|
36
|
+
let(:current_date) { Date.new(2015, 7, 1) }
|
37
|
+
|
38
|
+
it { expect(status).to eq :SPR3 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the permanent residency is on the on or after 3rd year" do
|
42
|
+
let(:current_date) { Date.new(2030, 7, 1) }
|
43
|
+
|
44
|
+
it { expect(status).to eq :SPR3 }
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2014::CitizenOrSPR3::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: 8.00, employee: 0.00, employer: 8.00 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when the total wages amounts to 53.12" do
|
32
|
+
let(:ordinary_wages) { 53.12 }
|
33
|
+
it { expect(result).to equal_cpf total: 8.00, employee: 0.00, employer: 8.00 }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the total wages amounts to 501. 66" do
|
37
|
+
let(:ordinary_wages) { 501.66 }
|
38
|
+
it { expect(result).to equal_cpf total: 81.00, employee: 0.00, employer: 81.00 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the total wages amounts to 501.67" do
|
42
|
+
let(:ordinary_wages) { 501.67 }
|
43
|
+
it { expect(result).to equal_cpf total: 81.00, employee: 1.00, employer: 80.00 }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when the total wages amounts to 749.99" do
|
47
|
+
let(:ordinary_wages) { 749.99 }
|
48
|
+
it { expect(result).to equal_cpf total: 270.00, employee: 149.00, employer: 121.00 }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when the total wages amounts to 750.00" do
|
52
|
+
let(:ordinary_wages) { 750.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 270.00, employee: 150.00, employer: 120.00 }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the total wages amounts to 5,000.00" do
|
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 }
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when the total wages amounts to 10,000.00" do
|
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 }
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2014::CitizenOrSPR3::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: 7.00, employee: 0.00, employer: 7.00 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when the total wages amounts to 53.12" do
|
32
|
+
let(:ordinary_wages) { 53.57 }
|
33
|
+
it { expect(result).to equal_cpf total: 7.00, employee: 0.00, employer: 7.00 }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the total wages amounts to 501.80" do
|
37
|
+
let(:ordinary_wages) { 501.80 }
|
38
|
+
it { expect(result).to equal_cpf total: 71.00, employee: 0.00, employer: 71.00 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the total wages amounts to 501.81" do
|
42
|
+
let(:ordinary_wages) { 501.81 }
|
43
|
+
it { expect(result).to equal_cpf total: 71.00, employee: 1.00, employer: 70.00 }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when the total wages amounts to 749.99" do
|
47
|
+
let(:ordinary_wages) { 749.99 }
|
48
|
+
it { expect(result).to equal_cpf total: 244.00, employee: 138.00, employer: 106.00 }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when the total wages amounts to 750.00" do
|
52
|
+
let(:ordinary_wages) { 750.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 244.00, employee: 138.00, employer: 106.00 }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the total wages amounts to 5,000.00" do
|
57
|
+
let(:ordinary_wages) { 5_000.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 1_625.00, employee: 925.00, employer: 700.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when the total wages amounts to 10,000.00" do
|
62
|
+
let(:ordinary_wages) { 10_000.00 }
|
63
|
+
it { expect(result).to equal_cpf total: 1_625.00, employee: 925.00, employer: 700.00 }
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2014::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: 5.00, employee: 0.00, employer: 5.00 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when the total wages amounts to 52.38" do
|
32
|
+
let(:ordinary_wages) { 52.38 }
|
33
|
+
it { expect(result).to equal_cpf total: 5.00, employee: 0.00, employer: 5.00 }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the total wages amounts to 502.56" do
|
37
|
+
let(:ordinary_wages) { 502.56 }
|
38
|
+
it { expect(result).to equal_cpf total: 54.00, employee: 0.00, employer: 54.00 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the total wages amounts to 502.57" do
|
42
|
+
let(:ordinary_wages) { 502.57 }
|
43
|
+
it { expect(result).to equal_cpf total: 54.00, employee: 1.00, employer: 53.00 }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when the total wages amounts to 749.99" do
|
47
|
+
let(:ordinary_wages) { 749.99 }
|
48
|
+
it { expect(result).to equal_cpf total: 176.00, employee: 97.00, employer: 79.00 }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when the total wages amounts to 750.00" do
|
52
|
+
let(:ordinary_wages) { 750.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 176.00, employee: 97.00, employer: 79.00 }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the total wages amounts to 5,000.00" do
|
57
|
+
let(:ordinary_wages) { 5_000.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 1_175.00, employee: 650.00, employer: 525.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when the total wages amounts to 10,000.00" do
|
62
|
+
let(:ordinary_wages) { 10_000.00 }
|
63
|
+
it { expect(result).to equal_cpf total: 1_175.00, employee: 650.00, employer: 525.00 }
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2014::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: 4.00, employee: 0.00, employer: 4.00 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when the total wages amounts to 64.28" do
|
32
|
+
let(:ordinary_wages) { 64.28 }
|
33
|
+
it { expect(result).to equal_cpf total: 4.00, employee: 0.00, employer: 4.00 }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the total wages amounts to 504.44" do
|
37
|
+
let(:ordinary_wages) { 504.44 }
|
38
|
+
it { expect(result).to equal_cpf total: 36.00, employee: 0.00, employer: 36.00 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the total wages amounts to 504.45" do
|
42
|
+
let(:ordinary_wages) { 504.45 }
|
43
|
+
it { expect(result).to equal_cpf total: 36.00, employee: 1.00, employer: 35.00 }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when the total wages amounts to 749.99" do
|
47
|
+
let(:ordinary_wages) { 749.99 }
|
48
|
+
it { expect(result).to equal_cpf total: 109.00, employee: 56.00, employer: 53.00 }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when the total wages amounts to 750.00" do
|
52
|
+
let(:ordinary_wages) { 750.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 109.00, employee: 56.00, employer: 53.00 }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the total wages amounts to 5,000.00" do
|
57
|
+
let(:ordinary_wages) { 5_000.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 725.00, employee: 375.00, employer: 350.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when the total wages amounts to 10,000.00" do
|
62
|
+
let(:ordinary_wages) { 10_000.00 }
|
63
|
+
it { expect(result).to equal_cpf total: 725.00, employee: 375.00, employer: 350.00 }
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCPFCalculator::Year2014::CitizenOrSPR3::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 53.84" do
|
27
|
+
let(:ordinary_wages) { 53.84 }
|
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 53.85" do
|
32
|
+
let(:ordinary_wages) { 53.85 }
|
33
|
+
it { expect(result).to equal_cpf total: 4.00, employee: 0.00, employer: 4.00 }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the total wages amounts to 506.66" do
|
37
|
+
let(:ordinary_wages) { 506.66 }
|
38
|
+
it { expect(result).to equal_cpf total: 34.00, employee: 0.00, employer: 34.00 }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the total wages amounts to 506.67" do
|
42
|
+
let(:ordinary_wages) { 506.67 }
|
43
|
+
it { expect(result).to equal_cpf total: 34.00, employee: 1.00, employer: 33.00 }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when the total wages amounts to 749.99" do
|
47
|
+
let(:ordinary_wages) { 749.99 }
|
48
|
+
it { expect(result).to equal_cpf total: 86.00, employee: 37.00, employer: 49.00 }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when the total wages amounts to 750.00" do
|
52
|
+
let(:ordinary_wages) { 750.00 }
|
53
|
+
it { expect(result).to equal_cpf total: 86.00, employee: 37.00, employer: 49.00 }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the total wages amounts to 5,000.00" do
|
57
|
+
let(:ordinary_wages) { 5_000.00 }
|
58
|
+
it { expect(result).to equal_cpf total: 575.00, employee: 250.00, employer: 325.00 }
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when the total wages amounts to 10,000.00" do
|
62
|
+
let(:ordinary_wages) { 10_000.00 }
|
63
|
+
it { expect(result).to equal_cpf total: 575.00, employee: 250.00, employer: 325.00 }
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|