Scenario: Reject an email that is not a valid address
Given the shopper is on the checkout form
When the shopper submits the email "not-an-email"
Then the page shows "Enter a valid email address" beside the email field
And the order is not placed
清单
- Submitting the email "not-an-email" shows "Enter a valid email address" beside the email field.
- The order is not placed.
When 只留一个。第二个动作就是第二个场景。And 延续同一个关键字:另一个 Given,或另一个 Then。不要用 And 夹带第二个行为。
The checkout form should handle bad input gracefully and feel fast.
可验证
When the shopper submits the email "not-an-email", the checkout page shows "Enter a valid email address" beside that field and does not place the order.
同一条 lint 命令不检查场景步骤的关键字。specscore rehearse 运行场景文件:Rehearse 指南在围栏命令上方使用 ## Given 或 ## When 这样的标题,并用 **Use:** 调用可复用的检查。一个文件里有一个 Given 和若干 When 分支时,会作为各自独立的案例运行。specscore rehearse new <feature-slug>#ac:<ac-slug> 读取功能 README,并把该标准里的 Given/When/Then 行抽到 spec/features/<feature-slug>/_tests/<ac-slug>.md。这些都不在 dogfood 工作流里运行。工作流运行的是 specscore spec lint。
内联标准,来自验收标准规格
## Acceptance Criteria
### AC: invalid-email-rejected
**Requirements:** checkout#req:reject-invalid-email
An email that is not a valid address is rejected, and the order is not placed.
精简标准文件,rehearse acs 读取的形态
# AC: invalid-email-rejected
**Status:** accepted
**Verifies:** checkout#req:reject-invalid-email
## Statement
An email that is not a valid address is rejected, and the order is not placed.
场景文件,来自场景规格
# Scenario: Reject an invalid email
**Validates:** [checkout#ac:invalid-email-rejected](../README.md#ac-invalid-email-rejected)
## Steps
GIVEN the shopper is on the checkout form
WHEN the shopper submits the email "not-an-email"
THEN the page shows "Enter a valid email address" beside the email field
AND the order is not placed
Rehearse 场景,Rehearse 指南里的形态
# Rehearse: Reject an invalid email
## Given a submitted email that is not a valid address
```bash
printf 'email=not-an-email\n' > form.txt
```
## When the response is recorded
```bash
printf 'Enter a valid email address\n' > out.txt
```
## Then the message is the invalid-email text
```bash
grep -q 'Enter a valid email address' out.txt
```