singapore_charitable_donations 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/circle.yml +3 -0
- data/lib/singapore_charitable_donations.rb +7 -0
- data/lib/singapore_charitable_donations/calculators.rb +39 -0
- data/lib/singapore_charitable_donations/calculators/cdac/year_2014_calculator.rb +31 -0
- data/lib/singapore_charitable_donations/calculators/cdac/year_2015_calculator.rb +37 -0
- data/lib/singapore_charitable_donations/calculators/ecf/year_2014_calculator.rb +38 -0
- data/lib/singapore_charitable_donations/calculators/ecf/year_2015_calculator.rb +41 -0
- data/lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb +40 -0
- data/lib/singapore_charitable_donations/calculators/sinda/year_2014_calculator.rb +37 -0
- data/lib/singapore_charitable_donations/calculators/sinda/year_2015_calculator.rb +43 -0
- data/lib/singapore_charitable_donations/version.rb +3 -0
- data/singapore_charitable_donations.gemspec +26 -0
- data/spec/singapore_charitable_donations/calculators/cdac/year_2014_calculator_spec.rb +28 -0
- data/spec/singapore_charitable_donations/calculators/cdac/year_2015_calculator_spec.rb +64 -0
- data/spec/singapore_charitable_donations/calculators/ecf/year_2014_calculator_spec.rb +64 -0
- data/spec/singapore_charitable_donations/calculators/ecf/year_2015_calculator_spec.rb +88 -0
- data/spec/singapore_charitable_donations/calculators/mbmf/year_2009_calculator_spec.rb +82 -0
- data/spec/singapore_charitable_donations/calculators/sinda/year_2014_calculator_spec.rb +52 -0
- data/spec/singapore_charitable_donations/calculators/sinda/year_2015_calculator_spec.rb +100 -0
- data/spec/singapore_charitable_donations/calculators_spec.rb +94 -0
- data/spec/spec_helper.rb +94 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6d058e264697bb6c240d86f4b07a240918c73ca7
|
4
|
+
data.tar.gz: 1bb01ab807069d29a2eb5bb9a9760e3f85a91774
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cff1143b380e35de1a85bf531df2a4305f58a5b72ba9aa8024260f589c84a76726055798c1201679addca281dc77d296442871a100b66435a0f5697231492249
|
7
|
+
data.tar.gz: 0e5e14f8df5fb795d34b5f24a0a9b82d32095f37da23ee4437ae003f91056755fbca412bc119ac3a1ac9bc6602b1543f872d079048ae354f6c942c94c71de2e5
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ronald Maravilla
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# SingaporeCharitableDonations
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/singapore_charitable_donations.svg)](http://badge.fury.io/rb/singapore_charitable_donations)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/payrollhero/singapore_charitable_donations/badges/gpa.svg)](https://codeclimate.com/github/payrollhero/singapore_charitable_donations)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/payrollhero/singapore_charitable_donations/badges/coverage.svg)](https://codeclimate.com/github/payrollhero/singapore_charitable_donations)
|
6
|
+
|
7
|
+
[![Circle CI](https://circleci.com/gh/payrollhero/singapore_charitable_donations.png?style=badge)](https://circleci.com/gh/payrollhero/singapore_charitable_donations)
|
8
|
+
|
9
|
+
This gem is a calculator for charitable donations in Singapore.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'singapore_charitable_donations'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install singapore_charitable_donations
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Currently supported charitable donation types:
|
30
|
+
* CDAC - Chinese Development Assistance Council Fund
|
31
|
+
* ECF - Eurasian Community Fund
|
32
|
+
* MBMF - Mosque Building and Mendaki Fund
|
33
|
+
* SINDA - Singapore Indian Development Association Fund
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
calculator = SingaporeCharitableDonations::Calculator.get(date: Date.new(2014, 12, 7), type: "CDAC")
|
37
|
+
cdac_amount = calculator.calculate(2_000.00)
|
38
|
+
cdac_amount #=> 1.00
|
39
|
+
```
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it ( https://github.com/[my-github-username]/singapore_charitable_donations/fork )
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/circle.yml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
|
4
|
+
# Collection of calculators for Singapore charitable donations.
|
5
|
+
class << self
|
6
|
+
|
7
|
+
# @param [Date] date Date of contribution
|
8
|
+
# @param [String] type The type of contribution fund. Can be CDAC, ECF, MBMF, SINDA
|
9
|
+
# @return [#calculator] The calculator depending on the type and date.
|
10
|
+
def get(date:, type:)
|
11
|
+
calculators.find { |calculator| calculator.applies_to?(date, type) }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def calculators
|
17
|
+
[
|
18
|
+
CDAC::Year2014Calculator,
|
19
|
+
CDAC::Year2015Calculator,
|
20
|
+
ECF::Year2014Calculator,
|
21
|
+
ECF::Year2015Calculator,
|
22
|
+
MBMF::Year2009Calculator,
|
23
|
+
SINDA::Year2014Calculator,
|
24
|
+
SINDA::Year2015Calculator,
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
require_relative 'calculators/cdac/year_2014_calculator'
|
34
|
+
require_relative 'calculators/cdac/year_2015_calculator'
|
35
|
+
require_relative 'calculators/ecf/year_2014_calculator'
|
36
|
+
require_relative 'calculators/ecf/year_2015_calculator'
|
37
|
+
require_relative 'calculators/mbmf/year_2009_calculator'
|
38
|
+
require_relative 'calculators/sinda/year_2014_calculator'
|
39
|
+
require_relative 'calculators/sinda/year_2015_calculator'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
module CDAC
|
4
|
+
|
5
|
+
# Chinese Development Assistance Council (CDAC) Fund contribution calculator for year 2014.
|
6
|
+
module Year2014Calculator
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# @param [BigDecimal] total_wage
|
10
|
+
# @return [BigDecimal] contribution amount
|
11
|
+
def calculate(total_wage)
|
12
|
+
case
|
13
|
+
when total_wage < 2_000.00
|
14
|
+
BigDecimal "0.50"
|
15
|
+
when total_wage >= 2_000.00
|
16
|
+
BigDecimal "1.00"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# @param [Date] date to be considered for calculation
|
21
|
+
# @param [String] type of charitable contribution
|
22
|
+
# @return [TrueClass, FalseClass]
|
23
|
+
def applies_to?(date, type)
|
24
|
+
date.year == 2014 && type == 'CDAC'
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
module CDAC
|
4
|
+
|
5
|
+
# Chinese Development Assistance Council (CDAC) Fund contribution calculator for year 2015 onwards.
|
6
|
+
module Year2015Calculator
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# @param [BigDecimal] total_wage
|
10
|
+
# @return [BigDecimal] contribution amount
|
11
|
+
def calculate(total_wage)
|
12
|
+
case
|
13
|
+
when total_wage <= 2_000.00
|
14
|
+
BigDecimal "0.50"
|
15
|
+
when total_wage <= 3_500.00
|
16
|
+
BigDecimal "1.00"
|
17
|
+
when total_wage <= 5_000.00
|
18
|
+
BigDecimal "1.50"
|
19
|
+
when total_wage <= 7_500.00
|
20
|
+
BigDecimal "2.00"
|
21
|
+
when total_wage > 7_500.00
|
22
|
+
BigDecimal "3.00"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param [Date] date to be considered for calculation
|
27
|
+
# @param [String] type of charitable contribution
|
28
|
+
# @return [TrueClass, FalseClass]
|
29
|
+
def applies_to?(date, type)
|
30
|
+
date.year >= 2015 && type == 'CDAC'
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
module ECF
|
4
|
+
|
5
|
+
# Eurasian Community Fund contribution calculator for the year 2014.
|
6
|
+
class Year2014Calculator
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# @param [BigDecimal] total_wage
|
10
|
+
# @return [BigDecimal] contribution amount
|
11
|
+
def calculate(total_wages)
|
12
|
+
case
|
13
|
+
when total_wages <= 1_000.00
|
14
|
+
BigDecimal "2.00"
|
15
|
+
when total_wages <= 1_500.00
|
16
|
+
BigDecimal "4.00"
|
17
|
+
when total_wages <= 2_500.00
|
18
|
+
BigDecimal "6.00"
|
19
|
+
when total_wages <= 4_000.00
|
20
|
+
BigDecimal "8.00"
|
21
|
+
else # total_wages > 4_000.00
|
22
|
+
BigDecimal "10.00"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param [Date] date to be considered for calculation
|
27
|
+
# @param [String] type of charitable contribution
|
28
|
+
# @return [TrueClass, FalseClass]
|
29
|
+
def applies_to?(date, type)
|
30
|
+
date.year == 2014 && type == 'ECF'
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
module ECF
|
4
|
+
|
5
|
+
# Eurasian Community Fund contribution calculator for the year 2015 onwards.
|
6
|
+
module Year2015Calculator
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# @param [BigDecimal] total_wage
|
10
|
+
# @return [BigDecimal] contribution amount
|
11
|
+
def calculate(total_wages)
|
12
|
+
case
|
13
|
+
when total_wages <= 1_000.00
|
14
|
+
BigDecimal "2.00"
|
15
|
+
when total_wages <= 1_500.00
|
16
|
+
BigDecimal "4.00"
|
17
|
+
when total_wages <= 2_500.00
|
18
|
+
BigDecimal "6.00"
|
19
|
+
when total_wages <= 4_000.00
|
20
|
+
BigDecimal "9.00"
|
21
|
+
when total_wages <= 7_000.00
|
22
|
+
BigDecimal "12.00"
|
23
|
+
when total_wages <= 10_000.00
|
24
|
+
BigDecimal "16.00"
|
25
|
+
else # total_wages > 10_000.00
|
26
|
+
BigDecimal "20.00"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param [Date] date to be considered for calculation
|
31
|
+
# @param [String] type of charitable contribution
|
32
|
+
# @return [TrueClass, FalseClass]
|
33
|
+
def applies_to?(date, type)
|
34
|
+
date.year >= 2015 && type == 'ECF'
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
module MBMF
|
4
|
+
|
5
|
+
# Mosque Building and Mendaki Fund contribution calculator for the year 2009 onwards.
|
6
|
+
module Year2009Calculator
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# @param [BigDecimal] total_wage
|
10
|
+
# @return [BigDecimal] contribution amount
|
11
|
+
def calculate(total_wages)
|
12
|
+
rounded_total_wages = total_wages.round
|
13
|
+
case
|
14
|
+
when rounded_total_wages <= 200.00
|
15
|
+
BigDecimal "0.00"
|
16
|
+
when rounded_total_wages <= 1_000.00
|
17
|
+
BigDecimal "2.00"
|
18
|
+
when rounded_total_wages <= 2_000.00
|
19
|
+
BigDecimal "3.50"
|
20
|
+
when rounded_total_wages <= 3_000.00
|
21
|
+
BigDecimal "5.00"
|
22
|
+
when rounded_total_wages <= 4_000.00
|
23
|
+
BigDecimal "12.50"
|
24
|
+
else # total_wages > 4_000.00
|
25
|
+
BigDecimal "16.00"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# @param [Date] date to be considered for calculation
|
30
|
+
# @param [String] type of charitable contribution
|
31
|
+
# @return [TrueClass, FalseClass]
|
32
|
+
def applies_to?(date, type)
|
33
|
+
date.year >= 2009 && type == 'MBMF'
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
module SINDA
|
4
|
+
|
5
|
+
# Singapore Indian Development Association Fund contribution calculator for the year 2014.
|
6
|
+
module Year2014Calculator
|
7
|
+
|
8
|
+
class << self
|
9
|
+
|
10
|
+
# @param [BigDecimal] total_wage
|
11
|
+
# @return [BigDecimal] contribution amount
|
12
|
+
def calculate(total_wages)
|
13
|
+
case
|
14
|
+
when total_wages <= 600.00
|
15
|
+
BigDecimal "1.00"
|
16
|
+
when total_wages <= 1_500.00
|
17
|
+
BigDecimal "3.00"
|
18
|
+
when total_wages <= 2_500.00
|
19
|
+
BigDecimal "5.00"
|
20
|
+
else # > 2_500.00
|
21
|
+
BigDecimal "7.00"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param [Date] date to be considered for calculation
|
26
|
+
# @param [String] type of charitable contribution
|
27
|
+
# @return [TrueClass, FalseClass]
|
28
|
+
def applies_to?(date, type)
|
29
|
+
date.year == 2014 && type == 'SINDA'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module SingaporeCharitableDonations
|
2
|
+
module Calculators
|
3
|
+
module SINDA
|
4
|
+
|
5
|
+
# Singapore Indian Development Association Fund contribution calculator for the year 2015 onwards.
|
6
|
+
module Year2015Calculator
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# @param [BigDecimal] total_wage
|
10
|
+
# @return [BigDecimal] contribution amount
|
11
|
+
def calculate(total_wages)
|
12
|
+
case
|
13
|
+
when total_wages <= 1_000.00
|
14
|
+
BigDecimal "1.00"
|
15
|
+
when total_wages <= 1_500.00
|
16
|
+
BigDecimal "3.00"
|
17
|
+
when total_wages <= 2_500.00
|
18
|
+
BigDecimal "5.00"
|
19
|
+
when total_wages <= 4_500.00
|
20
|
+
BigDecimal "7.00"
|
21
|
+
when total_wages <= 7_500.00
|
22
|
+
BigDecimal "9.00"
|
23
|
+
when total_wages <= 10_000.00
|
24
|
+
BigDecimal "12.00"
|
25
|
+
when total_wages <= 15_000.00
|
26
|
+
BigDecimal "18.00"
|
27
|
+
else # total_wages > 15_000.00
|
28
|
+
BigDecimal "30.00"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param [Date] date to be considered for calculation
|
33
|
+
# @param [String] type of charitable contribution
|
34
|
+
# @return [TrueClass, FalseClass]
|
35
|
+
def applies_to?(date, type)
|
36
|
+
date.year >= 2015 && type == 'SINDA'
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'singapore_charitable_donations/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "singapore_charitable_donations"
|
8
|
+
spec.version = SingaporeCharitableDonations::VERSION
|
9
|
+
spec.authors = ["Vincent Paca", "Ronald Maravilla"]
|
10
|
+
spec.email = ["vpaca@payrollhero.com", "rmaravilla@payrollhero.com"]
|
11
|
+
spec.summary = "Calculators for Singapore Charitable Donations"
|
12
|
+
spec.description = "Calculators for Singapore Charitable Donations. Supports CDAC, ECF, MBMF, and SINDA."
|
13
|
+
spec.homepage = "https://github.com/payrollhero/singapore_charitable_donations"
|
14
|
+
spec.license = "BSD-3-Clause"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "codeclimate-test-reporter"
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators::CDAC::Year2014Calculator do
|
4
|
+
|
5
|
+
subject(:result) { described_class.calculate(total_wages) }
|
6
|
+
|
7
|
+
describe '#calculate' do
|
8
|
+
|
9
|
+
context 'when the total wage is less than $2,000.00' do
|
10
|
+
let(:total_wages) { 1_000 }
|
11
|
+
let(:expected_contribution) { 0.50 }
|
12
|
+
it { expect(result).to eq(expected_contribution) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when the total wage is equal to $2,000.00' do
|
16
|
+
let(:total_wages) { 2_000 }
|
17
|
+
let(:expected_contribution) { 1.00 }
|
18
|
+
it { expect(result).to eq(expected_contribution) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the total wage is greater than $2,000.00' do
|
22
|
+
let(:total_wages) { 3_000 }
|
23
|
+
let(:expected_contribution) { 1.00 }
|
24
|
+
it { expect(result).to eq(expected_contribution) }
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators::CDAC::Year2015Calculator do
|
4
|
+
|
5
|
+
subject(:result) { described_class.calculate(total_wages) }
|
6
|
+
|
7
|
+
describe '#calculate' do
|
8
|
+
|
9
|
+
context 'when the total wage is less than $2,000.00' do
|
10
|
+
let(:total_wages) { 1_000.00 }
|
11
|
+
let(:expected_contribution) { 0.50 }
|
12
|
+
it { expect(result).to eq(expected_contribution) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when the total wage is equal $2,000.00' do
|
16
|
+
let(:total_wages) { 2_000.00 }
|
17
|
+
let(:expected_contribution) { 0.50 }
|
18
|
+
it { expect(result).to eq(expected_contribution) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the total wage is greater than $2,000.00 but less than $3,500.00' do
|
22
|
+
let(:total_wages) { 2_000.01 }
|
23
|
+
let(:expected_contribution) { 1.00 }
|
24
|
+
it { expect(result).to eq(expected_contribution) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the total wage is equal to $3,500.00' do
|
28
|
+
let(:total_wages) { 3_500.00 }
|
29
|
+
let(:expected_contribution) { 1.00 }
|
30
|
+
it { expect(result).to eq(expected_contribution) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the total wage is greater than $3,500.00 but less than $5,000.00' do
|
34
|
+
let(:total_wages) { 3_500.01 }
|
35
|
+
let(:expected_contribution) { 1.50 }
|
36
|
+
it { expect(result).to eq(expected_contribution) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the total wage is equal to $5,000.00' do
|
40
|
+
let(:total_wages) { 5_000.00 }
|
41
|
+
let(:expected_contribution) { 1.50 }
|
42
|
+
it { expect(result).to eq(expected_contribution) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when the total wage is greater than $5,000.00 but less than $7,500.00' do
|
46
|
+
let(:total_wages) { 5_000.01 }
|
47
|
+
let(:expected_contribution) { 2.00 }
|
48
|
+
it { expect(result).to eq(expected_contribution) }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when the total wage is equal to $7,500.00' do
|
52
|
+
let(:total_wages) { 7_500.00 }
|
53
|
+
let(:expected_contribution) { 2.00 }
|
54
|
+
it { expect(result).to eq(expected_contribution) }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when the total wage is greater than $7,500.00' do
|
58
|
+
let(:total_wages) { 8_500.01 }
|
59
|
+
let(:expected_contribution) { 3.00 }
|
60
|
+
it { expect(result).to eq(expected_contribution) }
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators::ECF::Year2014Calculator do
|
4
|
+
|
5
|
+
subject(:result) { described_class.calculate(total_wages) }
|
6
|
+
|
7
|
+
describe '#calculate' do
|
8
|
+
|
9
|
+
context 'when the total wage is less than $1,000.00' do
|
10
|
+
let(:total_wages) { 999.99 }
|
11
|
+
let(:expected_contribution) { 2.00 }
|
12
|
+
it { expect(result).to eq(expected_contribution) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when the total wage is equal to $1,000.00' do
|
16
|
+
let(:total_wages) { 1_000.00 }
|
17
|
+
let(:expected_contribution) { 2.00 }
|
18
|
+
it { expect(result).to eq(expected_contribution) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the total wage is greater than $1,000.00 but less than $1,500.00' do
|
22
|
+
let(:total_wages) { 1_000.01 }
|
23
|
+
let(:expected_contribution) { 4.00 }
|
24
|
+
it { expect(result).to eq(expected_contribution) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the total wage is equal to $1,500.00' do
|
28
|
+
let(:total_wages) { 1_500.00 }
|
29
|
+
let(:expected_contribution) { 4.00 }
|
30
|
+
it { expect(result).to eq(expected_contribution) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the total wage is greater than $1,500.00 but less than $2,500.00' do
|
34
|
+
let(:total_wages) { 1_500.01 }
|
35
|
+
let(:expected_contribution) { 6.00 }
|
36
|
+
it { expect(result).to eq(expected_contribution) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the total wage is equal to $2,500.00' do
|
40
|
+
let(:total_wages) { 2_500.00 }
|
41
|
+
let(:expected_contribution) { 6.00 }
|
42
|
+
it { expect(result).to eq(expected_contribution) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when the total wage is greater than $2,500.00 but less than $4,000.00' do
|
46
|
+
let(:total_wages) { 2_500.01 }
|
47
|
+
let(:expected_contribution) { 8.00 }
|
48
|
+
it { expect(result).to eq(expected_contribution) }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when the total wage is equal to $4,000.00' do
|
52
|
+
let(:total_wages) { 4_000.00 }
|
53
|
+
let(:expected_contribution) { 8.00 }
|
54
|
+
it { expect(result).to eq(expected_contribution) }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when the total wage is greater than $4,000.00' do
|
58
|
+
let(:total_wages) { 4_000.01 }
|
59
|
+
let(:expected_contribution) { 10.00 }
|
60
|
+
it { expect(result).to eq(expected_contribution) }
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators::ECF::Year2015Calculator do
|
4
|
+
|
5
|
+
subject(:result) { described_class.calculate(total_wages) }
|
6
|
+
|
7
|
+
describe '#calculate' do
|
8
|
+
|
9
|
+
context 'when the total wage is less than $1,000.00' do
|
10
|
+
let(:total_wages) { 999.99 }
|
11
|
+
let(:expected_contribution) { 2.00 }
|
12
|
+
it { expect(result).to eq(expected_contribution) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when the total wage is equal to $1,000.00' do
|
16
|
+
let(:total_wages) { 1_000.00 }
|
17
|
+
let(:expected_contribution) { 2.00 }
|
18
|
+
it { expect(result).to eq(expected_contribution) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the total wage is greater than $1,000.00 but less than $1,500.00' do
|
22
|
+
let(:total_wages) { 1_000.01 }
|
23
|
+
let(:expected_contribution) { 4.00 }
|
24
|
+
it { expect(result).to eq(expected_contribution) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the total wage is equal to $1,500.00' do
|
28
|
+
let(:total_wages) { 1_500.00 }
|
29
|
+
let(:expected_contribution) { 4.00 }
|
30
|
+
it { expect(result).to eq(expected_contribution) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the total wage is greater than $1,500.00 but less than $2,500.00' do
|
34
|
+
let(:total_wages) { 1_500.01 }
|
35
|
+
let(:expected_contribution) { 6.00 }
|
36
|
+
it { expect(result).to eq(expected_contribution) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the total wage is equal to $2,500.00' do
|
40
|
+
let(:total_wages) { 2_500.00 }
|
41
|
+
let(:expected_contribution) { 6.00 }
|
42
|
+
it { expect(result).to eq(expected_contribution) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when the total wage is greater than $2,500.00 but less than $4,000.00' do
|
46
|
+
let(:total_wages) { 2_500.01 }
|
47
|
+
let(:expected_contribution) { 9.00 }
|
48
|
+
it { expect(result).to eq(expected_contribution) }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when the total wage is equal to $4,000.00' do
|
52
|
+
let(:total_wages) { 4_000.00 }
|
53
|
+
let(:expected_contribution) { 9.00 }
|
54
|
+
it { expect(result).to eq(expected_contribution) }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when the total wage is greater than $4,000.00 but less than $7,000.00' do
|
58
|
+
let(:total_wages) { 4_000.01 }
|
59
|
+
let(:expected_contribution) { 12.00 }
|
60
|
+
it { expect(result).to eq(expected_contribution) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when the total wage equal to $7,000.00' do
|
64
|
+
let(:total_wages) { 7_000.00 }
|
65
|
+
let(:expected_contribution) { 12.00 }
|
66
|
+
it { expect(result).to eq(expected_contribution) }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when the total wage is greater than $7,000.00 but less than $10,000.00' do
|
70
|
+
let(:total_wages) { 7_000.01 }
|
71
|
+
let(:expected_contribution) { 16.00 }
|
72
|
+
it { expect(result).to eq(expected_contribution) }
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'when the total wage equal to $10,000.00' do
|
76
|
+
let(:total_wages) { 10_000.00 }
|
77
|
+
let(:expected_contribution) { 16.00 }
|
78
|
+
it { expect(result).to eq(expected_contribution) }
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'when the total wage is greater than $10,000.00' do
|
82
|
+
let(:total_wages) { 10_000.01 }
|
83
|
+
let(:expected_contribution) { 20.00 }
|
84
|
+
it { expect(result).to eq(expected_contribution) }
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators::MBMF::Year2009Calculator do
|
4
|
+
|
5
|
+
subject(:result) { described_class.calculate(total_wages) }
|
6
|
+
|
7
|
+
describe '#calculate' do
|
8
|
+
|
9
|
+
context 'when the total wage is less than $200.00' do
|
10
|
+
let(:total_wages) { 199.00 }
|
11
|
+
let(:expected_contribution) { 0.00 }
|
12
|
+
it { expect(result).to eq(expected_contribution) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when the total wage is equal to $200.00' do
|
16
|
+
let(:total_wages) { 200.00 }
|
17
|
+
let(:expected_contribution) { 0.00 }
|
18
|
+
it { expect(result).to eq(expected_contribution) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the total wage is greater than $200.00' do
|
22
|
+
let(:total_wages) { 201.00 }
|
23
|
+
let(:expected_contribution) { 2.00 }
|
24
|
+
it { expect(result).to eq(expected_contribution) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the total wage is less than $1,001.00' do
|
28
|
+
let(:total_wages) { 1_000.00 }
|
29
|
+
let(:expected_contribution) { 2.00 }
|
30
|
+
it { expect(result).to eq(expected_contribution) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the total wage is equal than $1,001.00' do
|
34
|
+
let(:total_wages) { 1_001.00 }
|
35
|
+
let(:expected_contribution) { 3.50 }
|
36
|
+
it { expect(result).to eq(expected_contribution) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the total wage is greater than $1,001.00 but less than $2,001.00' do
|
40
|
+
let(:total_wages) { 2_000.00 }
|
41
|
+
let(:expected_contribution) { 3.50 }
|
42
|
+
it { expect(result).to eq(expected_contribution) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when the total wage is equal to $2,001.00' do
|
46
|
+
let(:total_wages) { 2_001.00 }
|
47
|
+
let(:expected_contribution) { 5.00 }
|
48
|
+
it { expect(result).to eq(expected_contribution) }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when the total wage is greater than $2,001.00 but less than $3,001.00' do
|
52
|
+
let(:total_wages) { 3_000.00 }
|
53
|
+
let(:expected_contribution) { 5.00 }
|
54
|
+
it { expect(result).to eq(expected_contribution) }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when the total wage is equal to $3,001.00' do
|
58
|
+
let(:total_wages) { 3_001.00 }
|
59
|
+
let(:expected_contribution) { 12.50 }
|
60
|
+
it { expect(result).to eq(expected_contribution) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when the total wage is greater than $3,001.00 but less than $4,001.00' do
|
64
|
+
let(:total_wages) { 3_002.00 }
|
65
|
+
let(:expected_contribution) { 12.50 }
|
66
|
+
it { expect(result).to eq(expected_contribution) }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when the total wage is equal to $4,001.00' do
|
70
|
+
let(:total_wages) { 4_001.00 }
|
71
|
+
let(:expected_contribution) { 16.00 }
|
72
|
+
it { expect(result).to eq(expected_contribution) }
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'when the total wage is greater than $4,001.00' do
|
76
|
+
let(:total_wages) { 4_002.00 }
|
77
|
+
let(:expected_contribution) { 16.00 }
|
78
|
+
it { expect(result).to eq(expected_contribution) }
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators::SINDA::Year2014Calculator do
|
4
|
+
|
5
|
+
subject(:result) { described_class.calculate(total_wages) }
|
6
|
+
|
7
|
+
describe '#calculate' do
|
8
|
+
|
9
|
+
context 'when the total wage is less than $600.00' do
|
10
|
+
let(:total_wages) { 599.99 }
|
11
|
+
let(:expected_contribution) { 1.00 }
|
12
|
+
it { expect(result).to eq(expected_contribution) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when the total wage is equal $600.00' do
|
16
|
+
let(:total_wages) { 600.00 }
|
17
|
+
let(:expected_contribution) { 1.00 }
|
18
|
+
it { expect(result).to eq(expected_contribution) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the total wage is greater than $600.00 but less than $1,500.00' do
|
22
|
+
let(:total_wages) { 600.01 }
|
23
|
+
let(:expected_contribution) { 3.00 }
|
24
|
+
it { expect(result).to eq(expected_contribution) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the total wage is equal $1,500.00' do
|
28
|
+
let(:total_wages) { 1_500.00 }
|
29
|
+
let(:expected_contribution) { 3.00 }
|
30
|
+
it { expect(result).to eq(expected_contribution) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the total wage is greater than $1,500.00 but less than $2,500.00' do
|
34
|
+
let(:total_wages) { 1_500.01 }
|
35
|
+
let(:expected_contribution) { 5.00 }
|
36
|
+
it { expect(result).to eq(expected_contribution) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the total wage is equal to $2,500.00' do
|
40
|
+
let(:total_wages) { 2_500.00 }
|
41
|
+
let(:expected_contribution) { 5.00 }
|
42
|
+
it { expect(result).to eq(expected_contribution) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when the total wage is greater than $2,500.00' do
|
46
|
+
let(:total_wages) { 2_500.01 }
|
47
|
+
let(:expected_contribution) { 7.00 }
|
48
|
+
it { expect(result).to eq(expected_contribution) }
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators::SINDA::Year2015Calculator do
|
4
|
+
|
5
|
+
subject(:result) { described_class.calculate(total_wages) }
|
6
|
+
|
7
|
+
describe '#calculate' do
|
8
|
+
|
9
|
+
context 'when the total wage is less than $1,000.00' do
|
10
|
+
let(:total_wages) { 999.99 }
|
11
|
+
let(:expected_contribution) { 1.00 }
|
12
|
+
it { expect(result).to eq(expected_contribution) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when the total wage is equal to $1,000.00' do
|
16
|
+
let(:total_wages) { 1_000.00 }
|
17
|
+
let(:expected_contribution) { 1.00 }
|
18
|
+
it { expect(result).to eq(expected_contribution) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the total wage is greater than $1,000.00 but less than $1,500.00' do
|
22
|
+
let(:total_wages) { 1_000.01 }
|
23
|
+
let(:expected_contribution) { 3.00 }
|
24
|
+
it { expect(result).to eq(expected_contribution) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the total wage is equal to $1,500.00' do
|
28
|
+
let(:total_wages) { 1_500.00 }
|
29
|
+
let(:expected_contribution) { 3.00 }
|
30
|
+
it { expect(result).to eq(expected_contribution) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the total wage is greater than $1,500.00 but less than $2,500.00' do
|
34
|
+
let(:total_wages) { 1_500.01 }
|
35
|
+
let(:expected_contribution) { 5.00 }
|
36
|
+
it { expect(result).to eq(expected_contribution) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the total wage is equal to $2,500.00' do
|
40
|
+
let(:total_wages) { 2_500.00 }
|
41
|
+
let(:expected_contribution) { 5.00 }
|
42
|
+
it { expect(result).to eq(expected_contribution) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when the total wage is greater than $2,500.00 but less than $4,500.00' do
|
46
|
+
let(:total_wages) { 2_500.01 }
|
47
|
+
let(:expected_contribution) { 7.00 }
|
48
|
+
it { expect(result).to eq(expected_contribution) }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when the total wage is equal to $4,500.00' do
|
52
|
+
let(:total_wages) { 4_500.00 }
|
53
|
+
let(:expected_contribution) { 7.00 }
|
54
|
+
it { expect(result).to eq(expected_contribution) }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when the total wage is greater than $4,500.00 but less than $7,500.00' do
|
58
|
+
let(:total_wages) { 4_500.01 }
|
59
|
+
let(:expected_contribution) { 9.00 }
|
60
|
+
it { expect(result).to eq(expected_contribution) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when the total wage equal to $7,500.00' do
|
64
|
+
let(:total_wages) { 7_500.00 }
|
65
|
+
let(:expected_contribution) { 9.00 }
|
66
|
+
it { expect(result).to eq(expected_contribution) }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when the total wage is greater than $7,500.00 but less than $10,000.00' do
|
70
|
+
let(:total_wages) { 7_500.01 }
|
71
|
+
let(:expected_contribution) { 12.00 }
|
72
|
+
it { expect(result).to eq(expected_contribution) }
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'when the total wage equal to $10,000.00' do
|
76
|
+
let(:total_wages) { 10_000.00 }
|
77
|
+
let(:expected_contribution) { 12.00 }
|
78
|
+
it { expect(result).to eq(expected_contribution) }
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'when the total wage is greater than $10,000.00 but less than $15,000.00' do
|
82
|
+
let(:total_wages) { 10_000.01 }
|
83
|
+
let(:expected_contribution) { 18.00 }
|
84
|
+
it { expect(result).to eq(expected_contribution) }
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'when the total wage equal to $15,000.00' do
|
88
|
+
let(:total_wages) { 15_000.00 }
|
89
|
+
let(:expected_contribution) { 18.00 }
|
90
|
+
it { expect(result).to eq(expected_contribution) }
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when the total wage is greater than $15,000.00' do
|
94
|
+
let(:total_wages) { 15_000.01 }
|
95
|
+
let(:expected_contribution) { 30.00 }
|
96
|
+
it { expect(result).to eq(expected_contribution) }
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SingaporeCharitableDonations::Calculators do
|
4
|
+
|
5
|
+
subject(:calculator) { described_class.get(date: date, type: type) }
|
6
|
+
|
7
|
+
describe '#get' do
|
8
|
+
|
9
|
+
context 'when type is CDAC' do
|
10
|
+
let(:type) { 'CDAC' }
|
11
|
+
|
12
|
+
context 'when the year is 2014' do
|
13
|
+
let(:date) { Date.new(2014,1,1) }
|
14
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::CDAC::Year2014Calculator }
|
15
|
+
|
16
|
+
it { expect(calculator).to eq expected_calculator }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when the year is 2015' do
|
20
|
+
let(:date) { Date.new(2015,1,1) }
|
21
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::CDAC::Year2015Calculator }
|
22
|
+
|
23
|
+
it { expect(calculator).to eq expected_calculator }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when the year is 2016' do
|
27
|
+
let(:date) { Date.new(2016,12,5) }
|
28
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::CDAC::Year2015Calculator }
|
29
|
+
|
30
|
+
it { expect(calculator).to eq expected_calculator }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when type is ECF' do
|
35
|
+
let(:type) { 'ECF' }
|
36
|
+
|
37
|
+
context 'when the year is 2014' do
|
38
|
+
let(:date) { Date.new(2014,1,1) }
|
39
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::ECF::Year2014Calculator }
|
40
|
+
|
41
|
+
it { expect(calculator).to eq expected_calculator }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when year is 2015' do
|
45
|
+
let(:date) { Date.new(2015,1,1) }
|
46
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::ECF::Year2015Calculator }
|
47
|
+
|
48
|
+
it { expect(calculator).to eq expected_calculator }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when the year is 2016' do
|
52
|
+
let(:date) { Date.new(2016,12,5) }
|
53
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::ECF::Year2015Calculator }
|
54
|
+
|
55
|
+
it { expect(calculator).to eq expected_calculator }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'when type is MBMF' do
|
60
|
+
let(:type) { 'MBMF' }
|
61
|
+
let(:date) { Date.new(2014,1,1) }
|
62
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::MBMF::Year2009Calculator }
|
63
|
+
|
64
|
+
it { expect(calculator).to eq expected_calculator }
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'when type is SINDA' do
|
68
|
+
let(:type) { 'SINDA' }
|
69
|
+
|
70
|
+
context 'when the year is 2014' do
|
71
|
+
let(:date) { Date.new(2014,1,1) }
|
72
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::SINDA::Year2014Calculator }
|
73
|
+
|
74
|
+
it { expect(calculator).to eq expected_calculator }
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when year is 2015' do
|
78
|
+
let(:date) { Date.new(2015,1,1) }
|
79
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::SINDA::Year2015Calculator }
|
80
|
+
|
81
|
+
it { expect(calculator).to eq expected_calculator }
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'when the year is 2016' do
|
85
|
+
let(:date) { Date.new(2016,12,5) }
|
86
|
+
let(:expected_calculator) { SingaporeCharitableDonations::Calculators::SINDA::Year2015Calculator }
|
87
|
+
|
88
|
+
it { expect(calculator).to eq expected_calculator }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
require "codeclimate-test-reporter"
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
4
|
+
require 'singapore_charitable_donations'
|
5
|
+
|
6
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
7
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
8
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
9
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
10
|
+
#
|
11
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
12
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
13
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
14
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
15
|
+
# a separate helper file that requires the additional dependencies and performs
|
16
|
+
# the additional setup, and require it from the spec files that actually need it.
|
17
|
+
#
|
18
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
19
|
+
# users commonly want.
|
20
|
+
#
|
21
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
22
|
+
RSpec.configure do |config|
|
23
|
+
# rspec-expectations config goes here. You can use an alternate
|
24
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
25
|
+
# assertions if you prefer.
|
26
|
+
config.expect_with :rspec do |expectations|
|
27
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
28
|
+
# and `failure_message` of custom matchers include text for helper methods
|
29
|
+
# defined using `chain`, e.g.:
|
30
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
31
|
+
# # => "be bigger than 2 and smaller than 4"
|
32
|
+
# ...rather than:
|
33
|
+
# # => "be bigger than 2"
|
34
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
35
|
+
end
|
36
|
+
|
37
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
38
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
39
|
+
config.mock_with :rspec do |mocks|
|
40
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
41
|
+
# a real object. This is generally recommended, and will default to
|
42
|
+
# `true` in RSpec 4.
|
43
|
+
mocks.verify_partial_doubles = true
|
44
|
+
end
|
45
|
+
|
46
|
+
# The settings below are suggested to provide a good initial experience
|
47
|
+
# with RSpec, but feel free to customize to your heart's content.
|
48
|
+
=begin
|
49
|
+
# These two settings work together to allow you to limit a spec run
|
50
|
+
# to individual examples or groups you care about by tagging them with
|
51
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
52
|
+
# get run.
|
53
|
+
config.filter_run :focus
|
54
|
+
config.run_all_when_everything_filtered = true
|
55
|
+
|
56
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
57
|
+
# For more details, see:
|
58
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
59
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
60
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
61
|
+
config.disable_monkey_patching!
|
62
|
+
|
63
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
64
|
+
# be too noisy due to issues in dependencies.
|
65
|
+
config.warnings = true
|
66
|
+
|
67
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
68
|
+
# file, and it's useful to allow more verbose output when running an
|
69
|
+
# individual spec file.
|
70
|
+
if config.files_to_run.one?
|
71
|
+
# Use the documentation formatter for detailed output,
|
72
|
+
# unless a formatter has already been configured
|
73
|
+
# (e.g. via a command-line flag).
|
74
|
+
config.default_formatter = 'doc'
|
75
|
+
end
|
76
|
+
|
77
|
+
# Print the 10 slowest examples and example groups at the
|
78
|
+
# end of the spec run, to help surface which specs are running
|
79
|
+
# particularly slow.
|
80
|
+
config.profile_examples = 10
|
81
|
+
|
82
|
+
# Run specs in random order to surface order dependencies. If you find an
|
83
|
+
# order dependency and want to debug it, you can fix the order by providing
|
84
|
+
# the seed, which is printed after each run.
|
85
|
+
# --seed 1234
|
86
|
+
config.order = :random
|
87
|
+
|
88
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
89
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
90
|
+
# test failures related to randomization by passing the same `--seed` value
|
91
|
+
# as the one that triggered the failure.
|
92
|
+
Kernel.srand config.seed
|
93
|
+
=end
|
94
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: singapore_charitable_donations
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vincent Paca
|
8
|
+
- Ronald Maravilla
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.6'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.6'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: codeclimate-test-reporter
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
description: Calculators for Singapore Charitable Donations. Supports CDAC, ECF, MBMF,
|
71
|
+
and SINDA.
|
72
|
+
email:
|
73
|
+
- vpaca@payrollhero.com
|
74
|
+
- rmaravilla@payrollhero.com
|
75
|
+
executables: []
|
76
|
+
extensions: []
|
77
|
+
extra_rdoc_files: []
|
78
|
+
files:
|
79
|
+
- ".gitignore"
|
80
|
+
- ".rspec"
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- circle.yml
|
86
|
+
- lib/singapore_charitable_donations.rb
|
87
|
+
- lib/singapore_charitable_donations/calculators.rb
|
88
|
+
- lib/singapore_charitable_donations/calculators/cdac/year_2014_calculator.rb
|
89
|
+
- lib/singapore_charitable_donations/calculators/cdac/year_2015_calculator.rb
|
90
|
+
- lib/singapore_charitable_donations/calculators/ecf/year_2014_calculator.rb
|
91
|
+
- lib/singapore_charitable_donations/calculators/ecf/year_2015_calculator.rb
|
92
|
+
- lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb
|
93
|
+
- lib/singapore_charitable_donations/calculators/sinda/year_2014_calculator.rb
|
94
|
+
- lib/singapore_charitable_donations/calculators/sinda/year_2015_calculator.rb
|
95
|
+
- lib/singapore_charitable_donations/version.rb
|
96
|
+
- singapore_charitable_donations.gemspec
|
97
|
+
- spec/singapore_charitable_donations/calculators/cdac/year_2014_calculator_spec.rb
|
98
|
+
- spec/singapore_charitable_donations/calculators/cdac/year_2015_calculator_spec.rb
|
99
|
+
- spec/singapore_charitable_donations/calculators/ecf/year_2014_calculator_spec.rb
|
100
|
+
- spec/singapore_charitable_donations/calculators/ecf/year_2015_calculator_spec.rb
|
101
|
+
- spec/singapore_charitable_donations/calculators/mbmf/year_2009_calculator_spec.rb
|
102
|
+
- spec/singapore_charitable_donations/calculators/sinda/year_2014_calculator_spec.rb
|
103
|
+
- spec/singapore_charitable_donations/calculators/sinda/year_2015_calculator_spec.rb
|
104
|
+
- spec/singapore_charitable_donations/calculators_spec.rb
|
105
|
+
- spec/spec_helper.rb
|
106
|
+
homepage: https://github.com/payrollhero/singapore_charitable_donations
|
107
|
+
licenses:
|
108
|
+
- BSD-3-Clause
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.2.2
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Calculators for Singapore Charitable Donations
|
130
|
+
test_files:
|
131
|
+
- spec/singapore_charitable_donations/calculators/cdac/year_2014_calculator_spec.rb
|
132
|
+
- spec/singapore_charitable_donations/calculators/cdac/year_2015_calculator_spec.rb
|
133
|
+
- spec/singapore_charitable_donations/calculators/ecf/year_2014_calculator_spec.rb
|
134
|
+
- spec/singapore_charitable_donations/calculators/ecf/year_2015_calculator_spec.rb
|
135
|
+
- spec/singapore_charitable_donations/calculators/mbmf/year_2009_calculator_spec.rb
|
136
|
+
- spec/singapore_charitable_donations/calculators/sinda/year_2014_calculator_spec.rb
|
137
|
+
- spec/singapore_charitable_donations/calculators/sinda/year_2015_calculator_spec.rb
|
138
|
+
- spec/singapore_charitable_donations/calculators_spec.rb
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
has_rdoc:
|