Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/k-s-a/tax_test_app
Test app for tax calculation (testing with RSpec)
https://github.com/k-s-a/tax_test_app
Last synced: 5 days ago
JSON representation
Test app for tax calculation (testing with RSpec)
- Host: GitHub
- URL: https://github.com/k-s-a/tax_test_app
- Owner: K-S-A
- Created: 2016-06-30T23:33:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-01T08:40:51.000Z (over 8 years ago)
- Last Synced: 2024-12-29T13:25:59.869Z (10 days ago)
- Language: Ruby
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tax_test_app
## Installation:
bundle install
## Running specs:
rspec
## Example input:
spec/support/product_params.json
## Example output:
export/*.csv
## NOTE
For **Input 3**:
> Quantity, Product, Price
> 1, imported bottle of perfume, 27.99
> 1, bottle of perfume, 18.99
> 1, packet of headache pills, 9.75
> 1, box of imported chocolates, 11.25
Expected Output is:
> 1, imported bottle of perfume, 32.19
> 1, bottle of perfume, 20.89
> 1, packet of headache pills, 9.75
> 1, box of imported chocolates, 11.85
> Sales Taxes: 6.70
> Total: 74.68
Correct output is:
> 1, imported bottle of perfume, 32.19
> 1, bottle of perfume, 20.89
> 1, packet of headache pills, 9.75
> 1, box of imported chocolates, 11.8
> Sales Taxes: 6.65
> Total: 74.63
Reason:
For cart item '1, box of imported chocolates, 11.25':
- `base_tax_rate == 0`(%);
- `import_tax_rate == 5`(%);
- tax calculation:
- `tax == 11.25 * (0 + 5) / 100.0` (returns `0.5625`);
- `rounded_tax == (0.5625 * 20).round / 20.0` (returns `0.55` that is nearest `0.05` rounded value for `0.5625`);That causes sales tax and total to differ by 0.05 from expected result.