@@ -57,10 +57,65 @@ Feature: Generate HTML documentation from test examples
57
57
58
58
Scenario : Create an index of all API examples, including all resources and examples
59
59
Then the file "docs/index.html" should contain "<h2>Greetings</h2>"
60
- And the file "docs/index.html" should contain:
60
+ And the file "docs/index.html" should contain HTML :
61
61
"""
62
- <a href="greetings/greeting_your_favorite_gem.html">Greeting your favorite gem</a>
62
+ <h2>Greetings</h2>
63
+
64
+ <ul>
65
+ <li>
66
+ <a href="greetings/greeting_your_favorite_gem.html">Greeting your favorite gem</a>
67
+ </li>
68
+ </ul>
63
69
"""
64
70
65
- Scenario : Create a file for each API example
66
- Then the file "docs/greetings/greeting_your_favorite_gem.html" should contain "<h2>Greeting your favorite gem</h2>"
71
+ Scenario : Example HTML documentation includes the parameters
72
+ Then the file "docs/greetings/greeting_your_favorite_gem.html" should contain HTML:
73
+ """
74
+ <h3>Parameters</h3>
75
+ <table>
76
+ <thead>
77
+ <tr>
78
+ <th>Name</th>
79
+ <th>Description</th>
80
+ </tr>
81
+ </thead>
82
+ <tbody>
83
+ <tr>
84
+ <th>
85
+ <span class="name">target</span>
86
+ </th>
87
+ <td>
88
+ <span class="description">The thing you want to greet</span>
89
+ </td>
90
+ </tr>
91
+ </tbody>
92
+ </table>
93
+ """
94
+
95
+ Scenario : Example HTML documentation includes the request information
96
+ Then the file "docs/greetings/greeting_your_favorite_gem.html" should contain HTML:
97
+ """
98
+ <h3>Request</h3>
99
+ <h4>Headers</h4>
100
+ <pre class="headers">Host: example.org
101
+ Cookie: </pre>
102
+ <h4>Route</h4>
103
+ <pre class="request highlight">GET /greetings?target=rspec_api_documentation</pre>
104
+ <h4>Query Parameters</h4>
105
+ <pre class="request highlight">target: rspec_api_documentation</pre>
106
+ """
107
+
108
+ Scenario : Example HTML documentation includes the response information
109
+ Then the file "docs/greetings/greeting_your_favorite_gem.html" should contain HTML:
110
+ """
111
+ <h3>Response</h3>
112
+ <h4>Headers</h4>
113
+ <pre class="headers">Content-Type: application/json
114
+ Content-Length: 35</pre>
115
+ <h4>Status</h4>
116
+ <pre class="response_status">200 OK</pre>
117
+ <h4>Body</h4>
118
+ <pre class="response highlight">{
119
+ "hello": "rspec_api_documentation"
120
+ }</pre>
121
+ """
0 commit comments