Skip to content

Commit d979d45

Browse files
author
Leonard Chin
committed
Include API explanation in Slate template
1 parent 8b1938e commit d979d45

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

features/slate_documentation.feature

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Feature: Generate Slate documentation from test examples
4949
RspecApiDocumentation.configure do |config|
5050
config.app = App
5151
config.api_name = "Example API"
52-
config.api_explanation = "Description"
52+
config.api_explanation = "An explanation of the API"
5353
config.format = :slate
5454
config.curl_host = 'http://localhost:3000'
5555
config.request_headers_to_include = %w[Content-Type Host]
@@ -293,3 +293,9 @@ Feature: Generate Slate documentation from test examples
293293
"""
294294
## Getting welcome message
295295
"""
296+
297+
Scenario: API explanation should be included
298+
Then the file "doc/api/index.html.md" should contain:
299+
"""
300+
An explanation of the API
301+
"""

lib/rspec_api_documentation/writers/slate_writer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def write
2828
file.write %Q{ - shell: cURL\n}
2929
file.write %Q{---\n\n}
3030

31+
file.write configuration.api_explanation if configuration.api_explanation
32+
3133
IndexHelper.sections(index.examples, @configuration).each do |section|
3234

3335
file.write "# #{section[:resource_name]}\n\n"

0 commit comments

Comments
 (0)