-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from pplancq/feature/autobind
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ypescript/specs/step-definitions/auto-binding/auto-step-binding-beverage-vending.steps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { StepDefinitions, loadFeature, autoBindSteps } from '../../../../../src'; | ||
import { VendingMachine } from '../../../src/vending-machine'; | ||
|
||
export const vendingMachineSteps: StepDefinitions = ({ given, and, when, then }) => { | ||
let vendingMachine: VendingMachine; | ||
|
||
given(/^the vending machine has "(.*)" in stock$/, (itemName: string) => { | ||
vendingMachine = new VendingMachine(); | ||
vendingMachine.stockItem(itemName, 1); | ||
}); | ||
|
||
and('I have inserted the correct amount of money', () => { | ||
vendingMachine.insertMoney(0.5); | ||
}); | ||
|
||
when(/^I purchase "(.*)"$/, (itemName: string) => { | ||
vendingMachine.dispenseItem(itemName); | ||
}); | ||
|
||
then(/^my "(.*)" should be dispensed$/, (itemName: string) => { | ||
const inventoryAmount = vendingMachine.items[itemName]; | ||
expect(inventoryAmount).toBe(0); | ||
}); | ||
}; | ||
|
||
const features = loadFeature('./examples/typescript/specs/features/auto-binding/beverage-vending-machine.feature'); | ||
|
||
autoBindSteps(features, [vendingMachineSteps]); |
4 changes: 2 additions & 2 deletions
4
...ep-definitions/auto-step-binding.steps.ts → ...s/auto-binding/auto-step-binding.steps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters