Skip to content

Commit

Permalink
Tidy the feature up a bit, and sketch in the Step Definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
zspencer committed Jul 24, 2022
1 parent 328136f commit 49c6c1b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 23 deletions.
24 changes: 13 additions & 11 deletions features/furniture/marketplace.feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ Whether you're a farmers market or other local distributor, transactions between
local vendors and the community is the cornerstone of a strong regional economy.

A Marketplace connects producers, distributors and consumers in a single Space.

## Background
## Scenario: Place a Delivery Order
- Given a "Piikup Marketplace" Space
- And a "Marketplace" Furniture is in the Entrance Hall to the "Piikup Marketplace" Space
- And a Marketplace Vendor "Mandela Grocery" offers the following Products in the "Piikup Marketplace" Space
- And a "Marketplace" Furniture in the Entrance Hall to "Piikup Marketplace" Space is configured with:
| delivery_fee | $6.99 |
| order_notification_email | orders@piikup.org |
| stripe_account | piikup-stripe-key |
- And a Marketplace Vendor "Mandela Grocery" in the "Piikup Marketplace" Space has:
| stripe_account | mandela-stripe-key |
| order_notification_email | orders@mandelagrocery.coop |
- And the Marketplace Vendor "Mandela Grocery" offers the following Products in the "Piikup Marketplace" Space
| name | price |
| 1lb of Bananas | $1.39 |
| 32oz of Greek Yogurt | $7.99 |
- And a Marketplace Vendor "Piikup" offers Delivery Services in the "Piikup Marketplace" Space for the Marketplace Vendor "Mandela Grocery" for $6.99

## Scenario: Place a Delivery Order
- When a Guest places a Delivery Marketplace Order in the "Piikup Marketplace" Space for:
| item | quantity | price |
| 1lb of Bananas | 4 | $5.56 |
| 32oz of Greek Yogurt | 1 | $7.99 |
| Delivery by Piikup | 1 | $6.99 |
- Then the Guest is charged $20.54 for their Marketplace Order
- And the Marketplace Vendor "Piikup" receives the Marketplace Order placed by the Guest in the "Piikup Marketplace" Space
- And the Marketplace Vendor "Piikup" receives a Payment of $6.99
- And the Marketplace Vendor "Piikup" receives the Marketplace Order placed by the Guest in the "Piikup Marketplace" Space
- And the Marketplace Vendor "Mandela Grocery" receives a Payment of $13.55
- And the Marketplace Order placed by the Guest in the "Piikup Marketplace" Space is delivered to "orders@piikup.org"
- And the Stripe Account "piikup-stripe-key" receives a Payment of $6.99
- And the Marketplace Order placed by the Guest in the "Piikup Marketplace" Space is delivered to "orders@mandelagrocery.coop"
- And the Stripe Account "mandela-stripe-key" receives a Payment of $13.55
33 changes: 33 additions & 0 deletions features/steps/furniture/marketplace_steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Given, When, Then } from "@cucumber/cucumber";
Given('{a} Marketplace Vendor {string} in {a} {space} has:', function (a, string, a2, space, dataTable) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});


Given('{a} Marketplace Vendor {string} offers {a} following Products in {a} {space}', function (a, string, a2, a3, space, dataTable) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});

When('{a} {actor} places {a} Delivery Marketplace Order in {a} {space} for:', function (a, actor, a2, a3, space, dataTable) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});



Then('{a} Marketplace Order placed by {a} {actor} in {a} {space} is delivered to {string}', function (a, a2, actor, a3, space, string) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});

Then('{a} {actor} is charged ${float} for their Marketplace Order', function (a, actor, float) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});

Then('{a} Stripe Account {string} receives {a} Payment of ${float}', function (a, string, a2, float) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
12 changes: 0 additions & 12 deletions features/steps/furniture_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ Given(
}
);

Given('{a} {furniture} is in {a} {entranceHall} to {a} {space}', function (a, furniture, a2, room, a3, space) {
const furniturePlacementsAttributes = [
{
furnitureKind: furniture.type.toLowerCase(),
furnitureAttributes: {},
},
];
return this.api()
.rooms(space)
.update(room.assign({ furniturePlacementsAttributes }));
});

Then(
"{a} {furniture} is rendered with:",
/**
Expand Down

0 comments on commit 49c6c1b

Please sign in to comment.