Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattwynne/eeedbacf220be702e08b0c93027c1094 to your computer and use it in GitHub Desktop.
Save mattwynne/eeedbacf220be702e08b0c93027c1094 to your computer and use it in GitHub Desktop.
Feature: Calculate Variance
Assumptions, to keep things simple:
- Payroll period aligned with calendar month
- Benefit effective date = initiated date
- No loading on payroll cut-off date
- No other changes during the month that affect the result
- Employee gets a cover by default
- Variance calculation uses calendar months strategy
Background:
Given the following benefits:
| Name | Annual fee |
| Life assurance | £360 |
And the payroll cut-off dates are:
| June 2018 | 2018-06-15 |
| July 2018 | 2018-07-15 |
Scenario: Joins on the payroll start date
Given an employee with a benefit effective date of 2018-06-01 with:
| Life assurance |
When the June 2018 payroll report is run
Then the variance for the employee is £0
Scenario: Joins after payroll start date but before payroll cut-off date
Given an employee with a benefit effective date of 2018-06-02 with:
| Life assurance |
When the June payroll report is run
Then the variance for the employee is -£1
Scenario: Joins after payroll cut-off date
Variance of £15 is calulated by:
£1/day x 15 days (from 16th June -> 30th June inclusive)
Given an employee with a benefit effective date of 2018-06-16 with:
| Life assurance |
When the July 2018 payroll report is run
Then the variance for the employee is +£15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment