Sha256: cada6c6886fa6e98c3d3069a696b62ed97c0f6d1264619ac16caedfca97a94cb

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'

describe "Company A" do

  CSV.foreach('spec/acceptance/company_a.csv', headers: true) do |row|
    context "test: #{row.to_a}" do
      let(:result) {
        SingaporeCPFCalculator.calculate date: date,
                                         birthdate: birthdate,
                                         residency_status: residency_status,
                                         spr_start_date: spr_start_date,
                                         ordinary_wages: ordinary_wages,
                                         additional_wages: additional_wages,
                                         employee_contribution_type: employee_contribution_type,
                                         employer_contribution_type: employer_contribution_type
      }

      let(:expected_result) {
        SingaporeCPFCalculator::CPFContribution.new total: BigDecimal(row["Total CPF$"]),
                                                    employee: BigDecimal(row["Employee CPF$"]),
                                                    ow_subject_to_cpf: BigDecimal(row["OW Subject To CPF"]),
                                                    aw_subject_to_cpf: additional_wages
      }

      let(:date) { row["Contribution Date"].to_date }
      let(:birthdate) { row["Birthdate"].to_date }
      let(:residency_status) { row["Residency Status"] }
      let(:spr_start_date) { row["SPR Start Date"].try(:to_date) }
      let(:ordinary_wages) { BigDecimal(row["Ordinary Wages"]) }
      let(:additional_wages) { BigDecimal(row["Additional Wages"]) }
      let(:employee_contribution_type) { row["Employee Contribution Type"] }
      let(:employer_contribution_type) { row["Employer Contribution Type"] }

      it { expect(result).to eq expected_result }
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
singapore_cpf_calculator-1.5.1 spec/acceptance/company_a_spec.rb
singapore_cpf_calculator-1.5.0 spec/acceptance/company_a_spec.rb
singapore_cpf_calculator-1.4.0 spec/acceptance/company_a_spec.rb
singapore_cpf_calculator-1.3.4 spec/acceptance/company_a_spec.rb