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 で二つ目の振る舞いを紛れ込ませないでください。
チェックリストは、キーワードのない同じ契約です。各行はなお一つの観測できる結果です。上のチェックリストは、シナリオの Then をチェックとして書いたものです。
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
```