Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slate resource explanation #379

Merged
merged 3 commits into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions features/slate_documentation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Feature: Generate Slate documentation from test examples
end

resource 'Orders' do
explanation "An Order represents an amount of money to be paid"
get '/orders' do
response_field :page, "Current page"

Expand Down Expand Up @@ -214,6 +215,8 @@ Feature: Generate Slate documentation from test examples
"""
# Orders

An Order represents an amount of money to be paid

## Creating an order


Expand Down
3 changes: 1 addition & 2 deletions lib/rspec_api_documentation/writers/slate_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ def write
file.write markup_index_class.new(index, configuration).render

IndexHelper.sections(index.examples, @configuration).each do |section|

file.write "# #{section[:resource_name]}\n\n"
section[:examples].sort_by!(&:description) unless configuration.keep_source_order
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI This sort is already performed in IndexHelper

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

section[:examples].each do |example|
markup_example = markup_example_class.new(example, configuration)
Expand Down