Skip to content

Instantly share code, notes, and snippets.

@mlainez
Created December 4, 2020 20:31
Show Gist options
  • Save mlainez/da685875c119d7cdb5c1ac1ed05504a2 to your computer and use it in GitHub Desktop.
Save mlainez/da685875c119d7cdb5c1ac1ed05504a2 to your computer and use it in GitHub Desktop.
Feature: Scan passports with proper ruleset
We want to make the passport detection faster
to avoid long queues at the airport security.
A valid passport should have eight fields present
(byr, iyr, eyr, hgt, hcl, ecl, pid, cid) to be valid.
However, due to the time constraints around Christmas, it
would be preferable to consider passport missing the cid field
as valid. Such passports are North Pole credentials.
Scenario: When all eight fields are present, the passport is valid
Given a passport where all eight fields are present
When the passport is checked by the scanner
Then it is considered as valid
Scenario: When more than one fields are missing, the passport is invalid
Given a passport where more than one fields are missing
When the passport is checked by the scanner
Then it is considered as invalid
Scenario: When there is a North Pole credential, it should be considered valid
Given a valid North Pole credential
When the passport is checked by the scanner
Then it is considered as valid
Scenario: Passwords missing any other field than cid should be considered invalid
Given a passport missing the field "<missing_field>"
When the passport is checked by the scanner
Then it is considered as "<validity>"
Examples:
| missing_field | validity |
| byr | invalid |
| iyr | invalid |
| eyr | invalid |
| hgt | invalid |
| hcl | invalid |
| ecl | invalid |
| pid | invalid |
| cid | valid |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment